!function (e) {
    "object" == typeof exports && "object" == typeof module ? module.exports = e() : e()
}(function () {
    function BatchSend() {
        this.sendingData = 0
    }

    try {
        var sd = {};
        sd.modules = {};
        var _ = sd._ = {};
        "object" != typeof JSON && (JSON = {}), function () {
            "use strict";

            function f(e) {
                return e < 10 ? "0" + e : e
            }

            function this_value() {
                return this.valueOf()
            }

            function quote(e) {
                return rx_escapable.lastIndex = 0, rx_escapable.test(e) ? '"' + e.replace(rx_escapable, function (e) {
                    var t = meta[e];
                    return "string" == typeof t ? t : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
                }) + '"' : '"' + e + '"'
            }

            function str(e, t) {
                var r, s, a, n, i, o = gap, d = t[e];
                switch (d && "object" == typeof d && "function" == typeof d.toJSON && (d = d.toJSON(e)), "function" == typeof rep && (d = rep.call(t, e, d)), typeof d) {
                    case"string":
                        return quote(d);
                    case"number":
                        return isFinite(d) ? String(d) : "null";
                    case"boolean":
                    case"null":
                        return String(d);
                    case"object":
                        if (!d) return "null";
                        if (gap += indent, i = [], "[object Array]" === Object.prototype.toString.apply(d)) {
                            for (n = d.length, r = 0; r < n; r += 1) i[r] = str(r, d) || "null";
                            return a = 0 === i.length ? "[]" : gap ? "[\n" + gap + i.join(",\n" + gap) + "\n" + o + "]" : "[" + i.join(",") + "]", gap = o, a
                        }
                        if (rep && "object" == typeof rep) for (n = rep.length, r = 0; r < n; r += 1) "string" == typeof rep[r] && (s = rep[r], (a = str(s, d)) && i.push(quote(s) + (gap ? ": " : ":") + a)); else for (s in d) Object.prototype.hasOwnProperty.call(d, s) && (a = str(s, d)) && i.push(quote(s) + (gap ? ": " : ":") + a);
                        return a = 0 === i.length ? "{}" : gap ? "{\n" + gap + i.join(",\n" + gap) + "\n" + o + "}" : "{" + i.join(",") + "}", gap = o, a
                }
            }

            var rx_one = /^[\],:{}\s]*$/, rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
                rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
                rx_four = /(?:^|:|,)(?:\s*\[)+/g,
                rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
                rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
            "function" != typeof Date.prototype.toJSON && (Date.prototype.toJSON = function () {
                return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null
            }, Boolean.prototype.toJSON = this_value, Number.prototype.toJSON = this_value, String.prototype.toJSON = this_value);
            var gap, indent, meta, rep;
            "function" != typeof JSON.stringify && (meta = {
                "\b": "\\b",
                "\t": "\\t",
                "\n": "\\n",
                "\f": "\\f",
                "\r": "\\r",
                '"': '\\"',
                "\\": "\\\\"
            }, JSON.stringify = function (e, t, r) {
                var s;
                if (gap = "", indent = "", "number" == typeof r) for (s = 0; s < r; s += 1) indent += " "; else "string" == typeof r && (indent = r);
                if (rep = t, t && "function" != typeof t && ("object" != typeof t || "number" != typeof t.length)) throw new Error("JSON.stringify");
                return str("", {"": e})
            }), "function" != typeof JSON.parse && (JSON.parse = function (text, reviver) {
                function walk(e, t) {
                    var r, s, a = e[t];
                    if (a && "object" == typeof a) for (r in a) Object.prototype.hasOwnProperty.call(a, r) && (s = walk(a, r), void 0 !== s ? a[r] = s : delete a[r]);
                    return reviver.call(e, t, a)
                }

                var j;
                if (text = String(text), rx_dangerous.lastIndex = 0, rx_dangerous.test(text) && (text = text.replace(rx_dangerous, function (e) {
                    return "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
                })), rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) return j = eval("(" + text + ")"), "function" == typeof reviver ? walk({"": j}, "") : j;
                throw new SyntaxError("JSON.parse")
            })
        }(), function () {
            var e = Array.prototype, t = Function.prototype, r = Object.prototype, s = e.slice, a = r.toString,
                n = r.hasOwnProperty, i = (t.bind, e.forEach), o = (e.indexOf, Array.isArray), d = {},
                c = _.each = function (e, t, r) {
                    if (null == e) return !1;
                    if (i && e.forEach === i) e.forEach(t, r); else if (e.length === +e.length) {
                        for (var s = 0, a = e.length; s < a; s++) if (s in e && t.call(r, e[s], s, e) === d) return !1
                    } else for (var o in e) if (n.call(e, o) && t.call(r, e[o], o, e) === d) return !1
                };
            _.extend = function (e) {
                return c(s.call(arguments, 1), function (t) {
                    for (var r in t) void 0 !== t[r] && (e[r] = t[r])
                }), e
            }, _.extend2Lev = function (e) {
                return c(s.call(arguments, 1), function (t) {
                    for (var r in t) void 0 !== t[r] && (_.isObject(t[r]) && _.isObject(e[r]) ? _.extend(e[r], t[r]) : e[r] = t[r])
                }), e
            }, _.coverExtend = function (e) {
                return c(s.call(arguments, 1), function (t) {
                    for (var r in t) void 0 !== t[r] && void 0 === e[r] && (e[r] = t[r])
                }), e
            }, _.isArray = o || function (e) {
                return "[object Array]" === a.call(e)
            }, _.isFunction = function (e) {
                if (!e) return !1;
                try {
                    return /^\s*\bfunction\b/.test(e)
                } catch (e) {
                    return !1
                }
            }, _.isArguments = function (e) {
                return !(!e || !n.call(e, "callee"))
            }, _.toArray = function (e) {
                return e ? e.toArray ? e.toArray() : _.isArray(e) ? s.call(e) : _.isArguments(e) ? s.call(e) : _.values(e) : []
            }, _.values = function (e) {
                var t = [];
                return null == e ? t : (c(e, function (e) {
                    t[t.length] = e
                }), t)
            }, _.indexOf = function (e, t) {
                var r = e.indexOf;
                if (r) return r.call(e, t);
                for (var s = 0; s < e.length; s++) if (t === e[s]) return s;
                return -1
            }, _.hasAttribute = function (e, t) {
                return e.hasAttribute ? e.hasAttribute(t) : !(!e.attributes[t] || !e.attributes[t].specified)
            }, _.filter = function (e, t, r) {
                var s = Object.prototype.hasOwnProperty;
                if (e.filter) return e.filter(t);
                for (var a = [], n = 0; n < e.length; n++) if (s.call(e, n)) {
                    var i = e[n];
                    t.call(r, i, n, e) && a.push(i)
                }
                return a
            }, _.inherit = function (e, t) {
                return e.prototype = new t, e.prototype.constructor = e, e.superclass = t.prototype, e
            }, _.trim = function (e) {
                return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")
            }, _.isObject = function (e) {
                return null != e && "[object Object]" == a.call(e)
            }, _.isEmptyObject = function (e) {
                if (_.isObject(e)) {
                    for (var t in e) if (n.call(e, t)) return !1;
                    return !0
                }
                return !1
            }, _.isUndefined = function (e) {
                return void 0 === e
            }, _.isString = function (e) {
                return "[object String]" == a.call(e)
            }, _.isDate = function (e) {
                return "[object Date]" == a.call(e)
            }, _.isBoolean = function (e) {
                return "[object Boolean]" == a.call(e)
            }, _.isNumber = function (e) {
                return "[object Number]" == a.call(e) && /[\d\.]+/.test(String(e))
            }, _.isElement = function (e) {
                return !(!e || 1 !== e.nodeType)
            }, _.isJSONString = function (e) {
                try {
                    JSON.parse(e)
                } catch (e) {
                    return !1
                }
                return !0
            }, _.safeJSONParse = function (e) {
                var t = null;
                try {
                    t = JSON.parse(e)
                } catch (e) {
                    return !1
                }
                return t
            }, _.decodeURIComponent = function (e) {
                var t = e;
                try {
                    t = decodeURIComponent(e)
                } catch (r) {
                    t = e
                }
                return t
            }, _.encodeDates = function (e) {
                return _.each(e, function (t, r) {
                    _.isDate(t) ? e[r] = _.formatDate(t) : _.isObject(t) && (e[r] = _.encodeDates(t))
                }), e
            }, _.mediaQueriesSupported = function () {
                return void 0 !== window.matchMedia || void 0 !== window.msMatchMedia
            }, _.getScreenOrientation = function () {
                var e = screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type, t = "未取到值";
                if (e) t = e.indexOf("landscape") > -1 ? "landscape" : "portrait"; else if (_.mediaQueriesSupported()) {
                    var r = window.matchMedia || window.msMatchMedia;
                    r("(orientation: landscape)").matches ? t = "landscape" : r("(orientation: portrait)").matches && (t = "portrait")
                }
                return t
            }, _.now = Date.now || function () {
                return (new Date).getTime()
            }, _.throttle = function (e, t, r) {
                var s, a, n, i = null, o = 0;
                r || (r = {});
                var d = function () {
                    o = !1 === r.leading ? 0 : _.now(), i = null, n = e.apply(s, a), i || (s = a = null)
                };
                return function () {
                    var c = _.now();
                    o || !1 !== r.leading || (o = c);
                    var u = t - (c - o);
                    return s = this, a = arguments, u <= 0 || u > t ? (i && (clearTimeout(i), i = null), o = c, n = e.apply(s, a), i || (s = a = null)) : i || !1 === r.trailing || (i = setTimeout(d, u)), n
                }
            }, _.hashCode = function (e) {
                if ("string" != typeof e) return 0;
                var t = 0, r = null;
                if (0 == e.length) return t;
                for (var s = 0; s < e.length; s++) r = e.charCodeAt(s), t = (t << 5) - t + r, t &= t;
                return t
            }, _.formatDate = function (e) {
                function t(e) {
                    return e < 10 ? "0" + e : e
                }

                return e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + " " + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + "." + t(e.getMilliseconds())
            }, _.searchObjDate = function (e) {
                _.isObject(e) && _.each(e, function (t, r) {
                    _.isObject(t) ? _.searchObjDate(e[r]) : _.isDate(t) && (e[r] = _.formatDate(t))
                })
            }, _.searchZZAppStyle = function (e) {
                void 0 !== e.properties.$project && (e.project = e.properties.$project, delete e.properties.$project), void 0 !== e.properties.$token && (e.token = e.properties.$token, delete e.properties.$token)
            }, _.formatJsonString = function (e) {
                try {
                    return JSON.stringify(e, null, "  ")
                } catch (t) {
                    return JSON.stringify(e)
                }
            }, _.formatString = function (e) {
                return e.length > sd.para.max_string_length ? (sd.log(""), e.slice(0, sd.para.max_string_length)) : e
            }, _.searchObjString = function (e) {
                _.isObject(e) && _.each(e, function (t, r) {
                    _.isObject(t) ? _.searchObjString(e[r]) : _.isString(t) && (e[r] = _.formatString(t))
                })
            }, _.parseSuperProperties = function (e) {
                _.isObject(e) && (_.each(e, function (t, r) {
                    if (_.isFunction(t)) try {
                        e[r] = t(), _.isFunction(e[r]) && (sd.log(""), delete e[r])
                    } catch (t) {
                        delete e[r], sd.log("")
                    }
                }), _.strip_sa_properties(e))
            }, _.filterReservedProperties = function (e) {
                var t = ["distinct_id", "user_id", "id", "date", "datetime", "event", "events", "first_id", "original_id", "device_id", "properties", "second_id", "time", "users"];
                _.isObject(e) && _.each(t, function (t, r) {
                    t in e && (r < 3 ? (delete e[t], sd.log("")) : sd.log(""))
                })
            }, _.searchConfigData = function (e) {
                if ("object" == typeof e && e.$option) {
                    var t = e.$option;
                    return delete e.$option, t
                }
                return {}
            }, _.unique = function (e) {
                for (var t, r = [], s = {}, a = 0; a < e.length; a++) (t = e[a]) in s || (s[t] = !0, r.push(t));
                return r
            }, _.strip_sa_properties = function (e) {
                return _.isObject(e) ? (_.each(e, function (t, r) {
                    if (_.isArray(t)) {
                        var s = [];
                        _.each(t, function (e) {
                            _.isString(e) ? s.push(e) : sd.log("")
                        }), 0 !== s.length ? e[r] = s : (delete e[r], sd.log(""))
                    }
                    _.isString(t) || _.isNumber(t) || _.isDate(t) || _.isBoolean(t) || _.isArray(t) || _.isFunction(t) || "$option" === r || (sd.log(""), delete e[r])
                }), e) : e
            }, _.strip_empty_properties = function (e) {
                var t = {};
                return _.each(e, function (e, r) {
                    null != e && (t[r] = e)
                }), t
            }, _.utf8Encode = function (e) {
                e = (e + "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
                var t, r, s, a = "", n = 0;
                for (t = r = 0, n = e.length, s = 0; s < n; s++) {
                    var i = e.charCodeAt(s), o = null;
                    i < 128 ? r++ : o = i > 127 && i < 2048 ? String.fromCharCode(i >> 6 | 192, 63 & i | 128) : String.fromCharCode(i >> 12 | 224, i >> 6 & 63 | 128, 63 & i | 128), null !== o && (r > t && (a += e.substring(t, r)), a += o, t = r = s + 1)
                }
                return r > t && (a += e.substring(t, e.length)), a
            }, _.base64Encode = function (e) {
                if ("function" == typeof btoa) return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function (e, t) {
                    return String.fromCharCode("0x" + t)
                }));
                e = String(e);
                var t, r, s, a, n, i, o, d, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
                    u = 0, p = 0, l = "", f = [];
                if (!e) return e;
                e = _.utf8Encode(e);
                do {
                    t = e.charCodeAt(u++), r = e.charCodeAt(u++), s = e.charCodeAt(u++), d = t << 16 | r << 8 | s, a = d >> 18 & 63, n = d >> 12 & 63, i = d >> 6 & 63, o = 63 & d, f[p++] = c.charAt(a) + c.charAt(n) + c.charAt(i) + c.charAt(o)
                } while (u < e.length);
                switch (l = f.join(""), e.length % 3) {
                    case 1:
                        l = l.slice(0, -2) + "==";
                        break;
                    case 2:
                        l = l.slice(0, -1) + "="
                }
                return l
            }, _.UUID = function () {
                var e = function () {
                    for (var e = 1 * new Date, t = 0; e == 1 * new Date;) t++;
                    return e.toString(16) + t.toString(16)
                }, t = function () {
                    return Math.random().toString(16).replace(".", "")
                }, r = function (e) {
                    function t(e, t) {
                        var r, s = 0;
                        for (r = 0; r < t.length; r++) s |= n[r] << 8 * r;
                        return e ^ s
                    }

                    var r, s, a = navigator.userAgent, n = [], i = 0;
                    for (r = 0; r < a.length; r++) s = a.charCodeAt(r), n.unshift(255 & s), n.length >= 4 && (i = t(i, n), n = []);
                    return n.length > 0 && (i = t(i, n)), i.toString(16)
                };
                return function () {
                    var s = String(screen.height * screen.width);
                    s = s && /\d{5,}/.test(s) ? s.toString(16) : String(31242 * Math.random()).replace(".", "").slice(0, 8);
                    var a = e() + "-" + t() + "-" + r() + "-" + s + "-" + e();
                    return a || (String(Math.random()) + String(Math.random()) + String(Math.random())).slice(2, 15)
                }
            }(), _.getQueryParam = function (e, t) {
                t = t.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"), e = _.decodeURIComponent(e);
                var r = "[\\?&]" + t + "=([^&#]*)", s = new RegExp(r), a = s.exec(e);
                return null === a || a && "string" != typeof a[1] && a[1].length ? "" : _.decodeURIComponent(a[1])
            }, _.urlParse = function (e) {
                var t = function (e) {
                    this._fields = {
                        Username: 4,
                        Password: 5,
                        Port: 7,
                        Protocol: 2,
                        Host: 6,
                        Path: 8,
                        URL: 0,
                        QueryString: 9,
                        Fragment: 10
                    }, this._values = {}, this._regex = null, this._regex = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/, void 0 !== e && this._parse(e)
                };
                return t.prototype.setUrl = function (e) {
                    this._parse(e)
                }, t.prototype._initValues = function () {
                    for (var e in this._fields) this._values[e] = ""
                }, t.prototype.addQueryString = function (e) {
                    if ("object" != typeof e) return !1;
                    var t = this._values.QueryString || "";
                    for (var r in e) t = new RegExp(r + "[^&]+").test(t) ? t.replace(new RegExp(r + "[^&]+"), r + "=" + e[r]) : "&" === t.slice(-1) ? t + r + "=" + e[r] : "" === t ? r + "=" + e[r] : t + "&" + r + "=" + e[r];
                    this._values.QueryString = t
                }, t.prototype.getUrl = function () {
                    var e = "";
                    return e += this._values.Origin, e += this._values.Port ? ":" + this._values.Port : "", e += this._values.Path, e += this._values.QueryString ? "?" + this._values.QueryString : "", e += this._values.Fragment ? "#" + this._values.Fragment : ""
                }, t.prototype.getUrl = function () {
                    var e = "";
                    return e += this._values.Origin, e += this._values.Port ? ":" + this._values.Port : "", e += this._values.Path, e += this._values.QueryString ? "?" + this._values.QueryString : ""
                }, t.prototype._parse = function (e) {
                    this._initValues();
                    var t = this._regex.exec(e);
                    if (!t) throw"DPURLParser::_parse -> Invalid URL";
                    for (var r in this._fields) void 0 !== t[this._fields[r]] && (this._values[r] = t[this._fields[r]]);
                    this._values.Hostname = this._values.Host.replace(/:\d+$/, ""), this._values.Origin = this._values.Protocol + "://" + this._values.Hostname
                }, new t(e)
            }, _.addEvent = function () {
                function e(t) {
                    return t && (t.preventDefault = e.preventDefault, t.stopPropagation = e.stopPropagation, t._getPath = e._getPath), t
                }

                function t(t, r, s) {
                    return function (a) {
                        if (a = a || e(window.event)) {
                            a.target = a.srcElement;
                            var n, i, o = !0;
                            return "function" == typeof s && (n = s(a)), i = r.call(t, a), !1 !== n && !1 !== i || (o = !1), o
                        }
                    }
                }

                e._getPath = function () {
                    var e = this;
                    return this.path || this.composedPath && this.composedPath() || function () {
                        try {
                            var t = e.target, r = [t];
                            if (null === t || null === t.parentElement) return [];
                            for (; null !== t.parentElement;) t = t.parentElement, r.unshift(t);
                            return r
                        } catch (e) {
                            return []
                        }
                    }()
                }, e.preventDefault = function () {
                    this.returnValue = !1
                }, e.stopPropagation = function () {
                    this.cancelBubble = !0
                }, function (r, s, a) {
                    var n = !(!_.isObject(sd.para.heatmap) || !sd.para.heatmap.useCapture);
                    if (_.isObject(sd.para.heatmap) && void 0 === sd.para.heatmap.useCapture && "click" === s && (n = !0), r && r.addEventListener) r.addEventListener(s, function (t) {
                        t._getPath = e._getPath, a.call(this, t)
                    }, n); else {
                        var i = "on" + s, o = r[i];
                        r[i] = t(r, a, o)
                    }
                }.apply(null, arguments)
            }, _.addHashEvent = function (e) {
                var t = "pushState" in window.history ? "popstate" : "hashchange";
                _.addEvent(window, t, e)
            }, _.addSinglePageEvent = function (e) {
                var t = location.href, r = window.history.pushState, s = window.history.replaceState;
                window.history.pushState = function () {
                    r.apply(window.history, arguments), e(t), t = location.href
                }, window.history.replaceState = function () {
                    s.apply(window.history, arguments), e(t), t = location.href
                };
                var a = r ? "popstate" : "hashchange";
                _.addEvent(window, a, function () {
                    e(t), t = location.href
                })
            }, _.cookie = {
                get: function (e) {
                    for (var t = e + "=", r = document.cookie.split(";"), s = 0; s < r.length; s++) {
                        for (var a = r[s]; " " == a.charAt(0);) a = a.substring(1, a.length);
                        if (0 == a.indexOf(t)) return _.decodeURIComponent(a.substring(t.length, a.length))
                    }
                    return null
                }, set: function (e, t, r, s, a) {
                    s = void 0 === s ? sd.para.cross_subdomain : s;
                    var n = "", i = "", o = "";
                    if (r = null == r ? 73e3 : r, s) {
                        var d = _.getCurrentDomain(location.href);
                        "url解析失败" === d && (d = ""), n = d ? "; domain=" + d : ""
                    }
                    if (0 !== r) {
                        var c = new Date;
                        "s" === String(r).slice(-1) ? c.setTime(c.getTime() + 1e3 * Number(String(r).slice(0, -1))) : c.setTime(c.getTime() + 24 * r * 60 * 60 * 1e3), i = "; expires=" + c.toGMTString()
                    }
                    a && (o = "; secure"), document.cookie = e + "=" + encodeURIComponent(t) + i + "; path=/" + n + o
                }, remove: function (e, t) {
                    t = void 0 === t ? sd.para.cross_subdomain : t, _.cookie.set(e, "", -1, t)
                }, getCookieName: function (e, t) {
                    var r = "";
                    if (t = t || location.href, !1 === sd.para.cross_subdomain) {
                        try {
                            r = _.URL(t).hostname
                        } catch (e) {
                            sd.log(e)
                        }
                        r = "string" == typeof r && "" !== r ? "sajssdk_2015_" + e + "_" + r.replace(/\./g, "_") : "sajssdk_2015_root_" + e
                    } else r = "sajssdk_2015_cross_" + e;
                    return r
                }, getNewUser: function () {
                    return null !== this.get("sensorsdata_is_new_user") || null !== this.get(this.getCookieName("new_user"))
                }
            }, _.getElementContent = function (e, t) {
                var r = "", s = "";
                return e.textContent ? r = _.trim(e.textContent) : e.innerText && (r = _.trim(e.innerText)), r && (r = r.replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255)), s = r || "", "input" !== t && "INPUT" !== t || ("button" === e.type || "submit" === e.type ? s = e.value || "" : sd.para.heatmap && "function" == typeof sd.para.heatmap.collect_input && sd.para.heatmap.collect_input(e) && (s = e.value || "")), s
            }, _.getEleInfo = function (e) {
                if (!e.target) return !1;
                var t = e.target, r = t.tagName.toLowerCase(), s = {};
                return s.$element_type = r, s.$element_name = t.getAttribute("name"), s.$element_id = t.getAttribute("id"), s.$element_class_name = "string" == typeof t.className ? t.className : null, s.$element_target_url = t.getAttribute("href"), s.$element_content = _.getElementContent(t, r), s = _.strip_empty_properties(s), s.$url = location.href, s.$url_path = location.pathname, s.$title = document.title, s.$viewport_width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0, s
            }, _.localStorage = {
                get: function (e) {
                    return window.localStorage.getItem(e)
                }, parse: function (e) {
                    var t;
                    try {
                        t = JSON.parse(_.localStorage.get(e)) || null
                    } catch (e) {
                        sd.log(e)
                    }
                    return t
                }, set: function (e, t) {
                    window.localStorage.setItem(e, t)
                }, remove: function (e) {
                    window.localStorage.removeItem(e)
                }, isSupport: function () {
                    var e = !0;
                    try {
                        var t = "__sensorsdatasupport__", r = "testIsSupportStorage";
                        _.localStorage.set(t, r), _.localStorage.get(t) !== r && (e = !1), _.localStorage.remove(t)
                    } catch (t) {
                        e = !1
                    }
                    return e
                }
            }, _.sessionStorage = {
                isSupport: function () {
                    var e = !0, t = "__sensorsdatasupport__", r = "testIsSupportStorage";
                    try {
                        sessionStorage && sessionStorage.setItem ? (sessionStorage.setItem(t, r), sessionStorage.removeItem(t, r), e = !0) : e = !1
                    } catch (t) {
                        e = !1
                    }
                    return e
                }
            }, _.isSupportCors = function () {
                return void 0 !== window.XMLHttpRequest && ("withCredentials" in new XMLHttpRequest || "undefined" != typeof XDomainRequest)
            }, _.xhr = function (e) {
                if (e) return void 0 !== window.XMLHttpRequest && "withCredentials" in new XMLHttpRequest ? new XMLHttpRequest : "undefined" != typeof XDomainRequest ? new XDomainRequest : null;
                if (void 0 !== window.XMLHttpRequest) return new XMLHttpRequest;
                if (window.ActiveXObject) try {
                    return new ActiveXObject("Msxml2.XMLHTTP")
                } catch (e) {
                    try {
                        return new ActiveXObject("Microsoft.XMLHTTP")
                    } catch (e) {
                        sd.log(e)
                    }
                }
            }, _.ajax = function (e) {
                function t(e) {
                    if (!e) return "";
                    try {
                        return JSON.parse(e)
                    } catch (e) {
                        return {}
                    }
                }

                e.timeout = e.timeout || 2e4, e.credentials = void 0 === e.credentials || e.credentials;
                var r = _.xhr(e.cors);
                if (!r) return !1;
                e.type || (e.type = e.data ? "POST" : "GET"), e = _.extend({
                    success: function () {
                    }, error: function () {
                    }
                }, e);
                try {
                    "object" == typeof r && "timeout" in r ? r.timeout = e.timeout : setTimeout(function () {
                        r.abort()
                    }, e.timeout + 500)
                } catch (t) {
                    try {
                        setTimeout(function () {
                            r.abort()
                        }, e.timeout + 500)
                    } catch (e) {
                        sd.log(e)
                    }
                }
                r.onreadystatechange = function () {
                    try {
                        4 == r.readyState && (r.status >= 200 && r.status < 300 || 304 == r.status ? e.success(t(r.responseText)) : e.error(t(r.responseText), r.status), r.onreadystatechange = null, r.onload = null)
                    } catch (e) {
                        r.onreadystatechange = null, r.onload = null
                    }
                }, r.open(e.type, e.url, !0);
                try {
                    if (e.credentials && (r.withCredentials = !0), _.isObject(e.header)) for (var s in e.header) r.setRequestHeader(s, e.header[s]);
                    e.data && (e.cors || r.setRequestHeader("X-Requested-With", "XMLHttpRequest"), "application/json" === e.contentType ? r.setRequestHeader("Content-type", "application/json; charset=UTF-8") : r.setRequestHeader("Content-type", "application/x-www-form-urlencoded"))
                } catch (e) {
                    sd.log(e)
                }
                r.send(e.data || null)
            }, _.loadScript = function (e) {
                e = _.extend({
                    success: function () {
                    }, error: function () {
                    }, appendCall: function (e) {
                        document.getElementsByTagName("head")[0].appendChild(e)
                    }
                }, e);
                var t = null;
                "css" === e.type && (t = document.createElement("link"), t.rel = "stylesheet", t.href = e.url), "js" === e.type && (t = document.createElement("script"), t.async = "async", t.setAttribute("charset", "UTF-8"), t.src = e.url, t.type = "text/javascript"), t.onload = t.onreadystatechange = function () {
                    this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState || (e.success(), t.onload = t.onreadystatechange = null)
                }, t.onerror = function () {
                    e.error(), t.onerror = null
                }, e.appendCall(t)
            }, _.getHostname = function (e, t) {
                t && "string" == typeof t || (t = "hostname解析异常");
                var r = null;
                try {
                    r = _.URL(e).hostname
                } catch (e) {
                    sd.log(e)
                }
                return r || t
            }, _.getQueryParamsFromUrl = function (e) {
                var t = {}, r = e.split("?"), s = r[1] || "";
                return s && (t = _.getURLSearchParams("?" + s)), t
            }, _.getURLSearchParams = function (e) {
                e = e || "";
                for (var t = function (e) {
                    return decodeURIComponent(e)
                }, r = {}, s = e.substring(1), a = s.split("&"), n = 0; n < a.length; n++) {
                    var i = a[n].indexOf("=");
                    if (-1 !== i) {
                        var o = a[n].substring(0, i), d = a[n].substring(i + 1);
                        o = t(o), d = t(d), r[o] = d
                    }
                }
                return r
            }, _.URL = function (e) {
                var t = {},
                    r = ["hash", "host", "hostname", "href", "origin", "password", "pathname", "port", "protocol", "search", "username"];
                if ("function" == typeof window.URL && function () {
                    var e;
                    try {
                        return e = new URL("http://modernizr.com/"), "http://modernizr.com/" === e.href
                    } catch (e) {
                        return !1
                    }
                }()) t = new URL(e), t.searchParams || (t.searchParams = function () {
                    var e = _.getURLSearchParams(t.search);
                    return {
                        get: function (t) {
                            return e[t]
                        }
                    }
                }()); else {
                    if (!1 === /^https?:\/\/.+/.test(e)) throw"Invalid URL";
                    var s = document.createElement("a");
                    s.href = e;
                    for (var a = r.length - 1; a >= 0; a--) {
                        var n = r[a];
                        t[n] = s[n]
                    }
                    t.hostname && "string" == typeof t.pathname && 0 !== t.pathname.indexOf("/") && (t.pathname = "/" + t.pathname), t.searchParams = function () {
                        var e = _.getURLSearchParams(t.search);
                        return {
                            get: function (t) {
                                return e[t]
                            }
                        }
                    }()
                }
                return t
            }, _.getCurrentDomain = function (e) {
                var t = sd.para.current_domain;
                switch (typeof t) {
                    case"function":
                        var r = t();
                        return "" === r || "" === _.trim(r) ? "url解析失败" : -1 !== r.indexOf(".") ? r : "url解析失败";
                    case"string":
                        return "" === t || "" === _.trim(t) ? "url解析失败" : -1 !== t.indexOf(".") ? t : "url解析失败";
                    default:
                        var s = _.getCookieTopLevelDomain();
                        return "" === e ? "url解析失败" : "" === s ? "url解析失败" : s
                }
            }, _.getCookieTopLevelDomain = function (e) {
                e = e || window.location.hostname;
                var t = e.split(".");
                if (_.isArray(t) && t.length >= 2 && !/^(\d+\.)+\d+$/.test(e)) for (var r = "." + t.splice(t.length - 1, 1); t.length > 0;) if (r = "." + t.splice(t.length - 1, 1) + r, document.cookie = "sensorsdata_domain_test=true; path=/; domain=" + r, -1 !== document.cookie.indexOf("sensorsdata_domain_test=true")) {
                    var s = new Date;
                    return s.setTime(s.getTime() - 1e3), document.cookie = "sensorsdata_domain_test=true; expires=" + s.toGMTString() + "; path=/; domain=" + r, r
                }
                return ""
            }, _.isReferralTraffic = function (e) {
                return "" === (e = e || document.referrer) || _.getCookieTopLevelDomain(_.getHostname(e)) !== _.getCookieTopLevelDomain()
            }, _.ry = function (e) {
                return new _.ry.init(e)
            }, _.ry.init = function (e) {
                this.ele = e
            }, _.ry.init.prototype = {
                addClass: function (e) {
                    return -1 === (" " + this.ele.className + " ").indexOf(" " + e + " ") && (this.ele.className = this.ele.className + ("" === this.ele.className ? "" : " ") + e), this
                }, removeClass: function (e) {
                    var t = " " + this.ele.className + " ";
                    return -1 !== t.indexOf(" " + e + " ") && (this.ele.className = t.replace(" " + e + " ", " ").slice(1, -1)), this
                }, hasClass: function (e) {
                    return -1 !== (" " + this.ele.className + " ").indexOf(" " + e + " ")
                }, attr: function (e, t) {
                    return "string" == typeof e && _.isUndefined(t) ? this.ele.getAttribute(e) : ("string" == typeof e && (t = String(t), this.ele.setAttribute(e, t)), this)
                }, offset: function () {
                    var e = this.ele.getBoundingClientRect();
                    if (e.width || e.height) {
                        var t = this.ele.ownerDocument, r = t.documentElement;
                        return {
                            top: e.top + window.pageYOffset - r.clientTop,
                            left: e.left + window.pageXOffset - r.clientLeft
                        }
                    }
                    return {top: 0, left: 0}
                }, getSize: function () {
                    if (!window.getComputedStyle) return {width: this.ele.offsetWidth, height: this.ele.offsetHeight};
                    try {
                        var e = this.ele.getBoundingClientRect();
                        return {width: e.width, height: e.height}
                    } catch (e) {
                        return {width: 0, height: 0}
                    }
                }, getStyle: function (e) {
                    return this.ele.currentStyle ? this.ele.currentStyle[e] : this.ele.ownerDocument.defaultView.getComputedStyle(this.ele, null).getPropertyValue(e)
                }, wrap: function (e) {
                    var t = document.createElement(e);
                    return this.ele.parentNode.insertBefore(t, this.ele), t.appendChild(this.ele), _.ry(t)
                }, getCssStyle: function (e) {
                    var t = this.ele.style.getPropertyValue(e);
                    if (t) return t;
                    var r = null;
                    if ("function" == typeof window.getMatchedCSSRules && (r = getMatchedCSSRules(this.ele)), !r || !_.isArray(r)) return null;
                    for (var s = r.length - 1; s >= 0; s--) {
                        if (t = r[s].style.getPropertyValue(e)) return t
                    }
                }, sibling: function (e, t) {
                    for (; (e = e[t]) && 1 !== e.nodeType;) ;
                    return e
                }, next: function () {
                    return this.sibling(this.ele, "nextSibling")
                }, prev: function (e) {
                    return this.sibling(this.ele, "previousSibling")
                }, siblings: function (e) {
                    return this.siblings((this.ele.parentNode || {}).firstChild, this.ele)
                }, children: function (e) {
                    return this.siblings(this.ele.firstChild)
                }, parent: function () {
                    var e = this.ele.parentNode;
                    return e = e && 11 !== e.nodeType ? e : null, _.ry(e)
                }
            }, _.strToUnicode = function (e) {
                if ("string" != typeof e) return sd.log("转换unicode错误", e), e;
                for (var t = "", r = 0; r < e.length; r++) t += "\\" + e.charCodeAt(r).toString(16);
                return t
            }, _.getReferrer = function (e) {
                var e = e || document.referrer;
                return "string" != typeof e ? "取值异常_referrer异常_" + String(e) : (0 === e.indexOf("https://www.baidu.com/") && (e = e.split("?")[0]), e = e.slice(0, sd.para.max_referrer_string_length), "string" == typeof e ? e : "")
            }, _.getKeywordFromReferrer = function (e) {
                e = e || document.referrer;
                var t = sd.para.source_type.keyword;
                if (document && "string" == typeof e) {
                    if (0 === e.indexOf("http")) {
                        var r = _.getReferSearchEngine(e), s = _.getQueryParamsFromUrl(e);
                        if (_.isEmptyObject(s)) return "未取到值";
                        var a = null;
                        for (var n in t) if (r === n && "object" == typeof s) if (a = t[n], _.isArray(a)) for (var n = 0; n < a.length; n++) {
                            var i = s[a[n]];
                            if (i) return i
                        } else if (s[a]) return s[a];
                        return "未取到值"
                    }
                    return "" === e ? "未取到值_直接打开" : "未取到值_非http的url"
                }
                return "取值异常_referrer异常_" + String(e)
            }, _.getReferSearchEngine = function (e) {
                var t = _.getHostname(e);
                if (!t || "hostname解析异常" === t) return "";
                var r = (sd.para.source_type.keyword, {
                    baidu: [/^.*\.baidu\.com$/],
                    bing: [/^.*\.bing\.com$/],
                    google: [/^www\.google\.com$/, /^www\.google\.com\.[a-z]{2}$/, /^www\.google\.[a-z]{2}$/],
                    sm: [/^m\.sm\.cn$/],
                    so: [/^.+\.so\.com$/],
                    sogou: [/^.*\.sogou\.com$/],
                    yahoo: [/^.*\.yahoo\.com$/]
                });
                for (var s in r) for (var a = r[s], n = 0, i = a.length; n < i; n++) if (a[n].test(t)) return s;
                return "未知搜索引擎"
            }, _.getSourceFromReferrer = function () {
                function e(e, t) {
                    for (var r = 0; r < e.length; r++) if (-1 !== t.split("?")[0].indexOf(e[r])) return !0
                }

                var t = "(" + sd.para.source_type.utm.join("|") + ")\\=[^&]+", r = sd.para.source_type.search,
                    s = sd.para.source_type.social, a = document.referrer || "", n = _.info.pageProp.url;
                if (n) {
                    var i = n.match(new RegExp(t));
                    return i && i[0] ? "付费广告流量" : e(r, a) ? "自然搜索流量" : e(s, a) ? "社交网站流量" : "" === a ? "直接流量" : "引荐流量"
                }
                return "获取url异常"
            }, _.info = {
                initPage: function () {
                    var e = _.getReferrer(), t = location.href, r = _.getCurrentDomain(t);
                    r || sd.debug.jssdkDebug("url_domain异常_" + t + "_" + r), this.pageProp = {
                        referrer: e,
                        referrer_host: e ? _.getHostname(e) : "",
                        url: t,
                        url_host: _.getHostname(t, "url_host取值异常"),
                        url_domain: r
                    }
                }, pageProp: {}, campaignParams: function () {
                    var e = sd.source_channel_standard.split(" "), t = "", r = {};
                    return _.isArray(sd.para.source_channel) && sd.para.source_channel.length > 0 && (e = e.concat(sd.para.source_channel), e = _.unique(e)), _.each(e, function (e) {
                        t = _.getQueryParam(location.href, e), t.length && (r[e] = t)
                    }), r
                }, campaignParamsStandard: function (e, t) {
                    e = e || "", t = t || "";
                    var r = _.info.campaignParams(), s = {}, a = {};
                    for (var n in r) -1 !== (" " + sd.source_channel_standard + " ").indexOf(" " + n + " ") ? s[e + n] = r[n] : a[t + n] = r[n];
                    return {$utms: s, otherUtms: a}
                }, properties: function () {
                    return {
                        $screen_height: Number(screen.height) || 0,
                        $screen_width: Number(screen.width) || 0,
                        $lib: "js",
                        $lib_version: String(sd.lib_version)
                    }
                }, currentProps: {}, register: function (e) {
                    _.extend(_.info.currentProps, e)
                }
            }, _.autoExeQueue = function () {
                return {
                    items: [], enqueue: function (e) {
                        this.items.push(e), this.start()
                    }, dequeue: function () {
                        return this.items.shift()
                    }, getCurrentItem: function () {
                        return this.items[0]
                    }, isRun: !1, start: function () {
                        this.items.length > 0 && !this.isRun && (this.isRun = !0, this.getCurrentItem().start())
                    }, close: function () {
                        this.dequeue(), this.isRun = !1, this.start()
                    }
                }
            }, _.trackLink = function (e, t, r) {
                function s(e) {
                    function s() {
                        n || (n = !0, location.href = a.href)
                    }

                    e.stopPropagation(), e.preventDefault();
                    var n = !1;
                    setTimeout(s, 1e3), sd.track(t, r, s)
                }

                e = e || {};
                var a = null;
                return e.ele && (a = e.ele), e.event && (a = e.target ? e.target : e.event.target), r = r || {}, !(!a || "object" != typeof a) && (!a.href || /^javascript/.test(a.href) || a.target || a.download || a.onclick ? (sd.track(t, r), !1) : (e.event && s(e.event), void (e.ele && _.addEvent(e.ele, "click", function (e) {
                    s(e)
                }))))
            }, _.eventEmitter = function () {
                this._events = [], this.pendingEvents = []
            }, _.eventEmitter.prototype = {
                emit: function (e) {
                    var t = [].slice.call(arguments, 1);
                    _.each(this._events, function (r) {
                        r.type === e && r.callback.apply(r.context, t)
                    })
                }, on: function (e, t, r) {
                    "function" == typeof t && this._events.push({type: e, callback: t, context: r || this})
                }, tempAdd: function (e, t) {
                    t && e && (this.pendingEvents.push({
                        type: e,
                        data: t
                    }), this.pendingEvents.length > 20 && this.pendingEvents.shift())
                }, isReady: function () {
                    var e = this;
                    this.tempAdd = this.emit, 0 !== this.pendingEvents.length && (_.each(this.pendingEvents, function (t) {
                        e.emit(t.type, t.data)
                    }), this.pendingEvents = [])
                }
            }
        }(), sd.para_default = {
            preset_properties: {
                latest_utm: !0,
                latest_traffic_source_type: !0,
                latest_search_keyword: !0,
                latest_referrer: !0,
                latest_referrer_host: !1,
                latest_landing_page: !1,
                url: !1,
                title: !1
            },
            img_use_crossorigin: !1,
            name: "sa",
            max_referrer_string_length: 200,
            max_string_length: 500,
            cross_subdomain: !0,
            show_log: !0,
            is_debug: !1,
            debug_mode: !1,
            debug_mode_upload: !1,
            session_time: 0,
            use_client_time: !1,
            source_channel: [],
            send_type: "image",
            vtrack_ignore: {},
            auto_init: !0,
            is_track_single_page: !1,
            is_single_page: !1,
            batch_send: !1,
            source_type: {},
            callback_timeout: 200,
            datasend_timeout: 3e3,
            queue_timeout: 300,
            is_track_device_id: !1,
            ignore_oom: !0,
            app_js_bridge: !1
        }, sd.addReferrerHost = function (e) {
            var t = "取值异常";
            _.isObject(e.properties) && (e.properties.$first_referrer && (e.properties.$first_referrer_host = _.getHostname(e.properties.$first_referrer, t)), "track" !== e.type && "track_signup" !== e.type || ("$referrer" in e.properties && (e.properties.$referrer_host = "" === e.properties.$referrer ? "" : _.getHostname(e.properties.$referrer, t)), sd.para.preset_properties.latest_referrer && sd.para.preset_properties.latest_referrer_host && (e.properties.$latest_referrer_host = "" === e.properties.$latest_referrer ? "" : _.getHostname(e.properties.$latest_referrer, t))))
        }, sd.addPropsHook = function (e) {
            sd.para.preset_properties && sd.para.preset_properties.url && ("track" === e.type || "track_signup" === e.type) && void 0 === e.properties.$url && (e.properties.$url = window.location.href), sd.para.preset_properties && sd.para.preset_properties.title && ("track" === e.type || "track_signup" === e.type) && void 0 === e.properties.$title && (e.properties.$title = document.title)
        }, sd.initPara = function (e) {
            sd.para = e || sd.para || {};
            var t = {};
            if (_.isObject(sd.para.is_track_latest)) for (var r in sd.para.is_track_latest) t["latest_" + r] = sd.para.is_track_latest[r];
            sd.para.preset_properties = _.extend({}, sd.para_default.preset_properties, t, sd.para.preset_properties || {});
            var s;
            for (s in sd.para_default) void 0 === sd.para[s] && (sd.para[s] = sd.para_default[s]);
            "string" == typeof sd.para.server_url && "://" === sd.para.server_url.slice(0, 3) && (sd.para.server_url = location.protocol.slice(-1) + sd.para.server_url), "string" == typeof sd.para.web_url && "://" === sd.para.web_url.slice(0, 3) && (sd.para.web_url = location.protocol.slice(-1) + sd.para.web_url), "image" !== sd.para.send_type && "ajax" !== sd.para.send_type && "beacon" !== sd.para.send_type && (sd.para.send_type = "image"), sd.bridge.initPara(), sd.bridge.initState();
            var a = {datasend_timeout: 6e3, send_interval: 6e3, one_send_max_length: 6};
            _.localStorage.isSupport() && _.isSupportCors() && "object" == typeof localStorage ? !0 === sd.para.batch_send ? (sd.para.batch_send = _.extend({}, a), sd.para.use_client_time = !0) : "object" == typeof sd.para.batch_send && (sd.para.use_client_time = !0, sd.para.batch_send = _.extend({}, a, sd.para.batch_send)) : sd.para.batch_send = !1;
            var n = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"],
                i = ["www.baidu.", "m.baidu.", "m.sm.cn", "so.com", "sogou.com", "youdao.com", "google.", "yahoo.com/", "bing.com/", "ask.com/"],
                o = ["weibo.com", "renren.com", "kaixin001.com", "douban.com", "qzone.qq.com", "zhihu.com", "tieba.baidu.com", "weixin.qq.com"],
                d = {
                    baidu: ["wd", "word", "kw", "keyword"],
                    google: "q",
                    bing: "q",
                    yahoo: "p",
                    sogou: ["query", "keyword"],
                    so: "q",
                    sm: "q"
                };
            if ("object" == typeof sd.para.source_type && (sd.para.source_type.utm = _.isArray(sd.para.source_type.utm) ? sd.para.source_type.utm.concat(n) : n, sd.para.source_type.search = _.isArray(sd.para.source_type.search) ? sd.para.source_type.search.concat(i) : i, sd.para.source_type.social = _.isArray(sd.para.source_type.social) ? sd.para.source_type.social.concat(o) : o, sd.para.source_type.keyword = _.isObject(sd.para.source_type.keyword) ? _.extend(d, sd.para.source_type.keyword) : d), _.isObject(sd.para.heatmap) && (sd.para.heatmap.clickmap = sd.para.heatmap.clickmap || "default",
                sd.para.heatmap.scroll_notice_map = sd.para.heatmap.scroll_notice_map || "default", sd.para.heatmap.scroll_delay_time = sd.para.heatmap.scroll_delay_time || 4e3, sd.para.heatmap.scroll_event_duration = sd.para.heatmap.scroll_event_duration || 18e3, sd.para.heatmap.renderRefreshTime = sd.para.heatmap.renderRefreshTime || 1e3, sd.para.heatmap.loadTimeout = sd.para.heatmap.loadTimeout || 1e3), "object" == typeof sd.para.server_url && sd.para.server_url.length) for (s = 0; s < sd.para.server_url.length; s++) /sa\.gif[^\/]*$/.test(sd.para.server_url[s]) || (sd.para.server_url[s] = sd.para.server_url[s].replace(/\/sa$/, "/sa.gif").replace(/(\/sa)(\?[^\/]+)$/, "/sa.gif$2")); else /sa\.gif[^\/]*$/.test(sd.para.server_url) || (sd.para.server_url = sd.para.server_url.replace(/\/sa$/, "/sa.gif").replace(/(\/sa)(\?[^\/]+)$/, "/sa.gif$2"));
            "string" == typeof sd.para.server_url && (sd.para.debug_mode_url = sd.para.debug_mode_url || sd.para.server_url.replace("sa.gif", "debug")), !0 === sd.para.noCache ? sd.para.noCache = "?" + (new Date).getTime() : sd.para.noCache = "", sd.para.callback_timeout > sd.para.datasend_timeout && (sd.para.datasend_timeout = sd.para.callback_timeout), sd.para.callback_timeout > sd.para.queue_timeout && (sd.para.queue_timeout = sd.para.callback_timeout), sd.para.queue_timeout > sd.para.datasend_timeout && (sd.para.datasend_timeout = sd.para.queue_timeout)
        }, sd.readyState = {
            state: 0,
            historyState: [],
            stateType: {1: "1-init未开始", 2: "2-init开始", 3: "3-store完成"},
            getState: function () {
                return this.historyState.join("\n")
            },
            setState: function (e) {
                String(e) in this.stateType && (this.state = e), this.historyState.push(this.stateType[e])
            }
        }, sd.setPreConfig = function (e) {
            sd.para = e.para, sd._q = e._q
        }, sd.setInitVar = function () {
            sd._t = sd._t || 1 * new Date, sd.lib_version = "1.15.6", sd.is_first_visitor = !1, sd.source_channel_standard = "utm_source utm_medium utm_campaign utm_content utm_term"
        }, sd.log = function () {
            if ((_.sessionStorage.isSupport() && "true" === sessionStorage.getItem("sensorsdata_jssdk_debug") || sd.para.show_log) && (!0 !== sd.para.show_log && "string" !== sd.para.show_log && !1 !== sd.para.show_log || (arguments[0] = _.formatJsonString(arguments[0])), "object" == typeof console && console.log)) try {
                return console.log.apply(console, arguments)
            } catch (e) {
                console.log(arguments[0])
            }
        }, sd.enableLocalLog = function () {
            if (_.sessionStorage.isSupport()) try {
                sessionStorage.setItem("sensorsdata_jssdk_debug", "true")
            } catch (e) {
                sd.log("enableLocalLog error: " + e.message)
            }
        }, sd.disableLocalLog = function () {
            _.sessionStorage.isSupport() && sessionStorage.removeItem("sensorsdata_jssdk_debug")
        }, sd.debug = {
            distinct_id: function () {
            }, jssdkDebug: function () {
            }, _sendDebug: function (e) {
                sd.track("_sensorsdata2019_debug", {_jssdk_debug_info: e})
            }, apph5: function (e) {
                var t = "app_h5打通失败-", r = {
                    1: t + "use_app_track为false",
                    2: t + "Android或者iOS，没有暴露相应方法",
                    3.1: t + "Android校验server_url失败",
                    3.2: t + "iOS校验server_url失败",
                    4.1: t + "H5 校验 iOS server_url 失败",
                    4.2: t + "H5 校验 Android server_url 失败"
                }, s = e.output, a = e.step, n = e.data || "";
                "all" !== s && "console" !== s || sd.log(r[a]), ("all" === s || "code" === s) && _.isObject(sd.para.is_debug) && sd.para.is_debug.apph5 && (n.type && "profile" === n.type.slice(0, 7) || (n.properties._jssdk_debug_info = "apph5-" + String(a)))
            }, defineMode: function (e) {
                var t = {
                    1: {
                        title: "当前页面无法进行可视化全埋点",
                        message: "App SDK 与 Web JS SDK 没有进行打通，请联系贵方技术人员修正 App SDK 的配置，详细信息请查看文档。",
                        link_text: "配置文档",
                        link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_link-1573913.html"
                    },
                    2: {
                        title: "当前页面无法进行可视化全埋点",
                        message: "App SDK 与 Web JS SDK 没有进行打通，请联系贵方技术人员修正 Web JS SDK 的配置，详细信息请查看文档。",
                        link_text: "配置文档",
                        link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_link-1573913.html"
                    },
                    3: {
                        title: "当前页面无法进行可视化全埋点",
                        message: "Web JS SDK 没有开启全埋点配置，请联系贵方工作人员修正 SDK 的配置，详细信息请查看文档。",
                        link_text: "配置文档",
                        link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_web_all-1573964.html"
                    },
                    4: {
                        title: "当前页面无法进行可视化全埋点",
                        message: "Web JS SDK 配置的数据校验地址与 App SDK 配置的数据校验地址不一致，请联系贵方工作人员修正 SDK 的配置，详细信息请查看文档。",
                        link_text: "配置文档",
                        link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_link-1573913.html"
                    }
                };
                return !(!e || !t[e]) && t[e]
            }
        };
        var commonWays = {
            setOnlineState: function (e) {
                if (!0 === e && _.isObject(sd.para.jsapp) && "function" == typeof sd.para.jsapp.getData) {
                    sd.para.jsapp.isOnline = !0;
                    var t = sd.para.jsapp.getData();
                    _.isArray(t) && t.length > 0 && _.each(t, function (e) {
                        _.isJSONString(e) && sd.sendState.pushSend(JSON.parse(e))
                    })
                } else sd.para.jsapp.isOnline = !1
            }, autoTrackIsUsed: !1, isReady: function (e) {
                e()
            }, getUtm: function () {
                return _.info.campaignParams()
            }, getStayTime: function () {
                return (new Date - sd._t) / 1e3
            }, setProfileLocal: function (e) {
                if (!_.localStorage.isSupport()) return sd.setProfile(e), !1;
                if (!_.isObject(e) || _.isEmptyObject(e)) return !1;
                var t = _.localStorage.parse("sensorsdata_2015_jssdk_profile"), r = !1;
                if (_.isObject(t) && !_.isEmptyObject(t)) {
                    for (var s in e) !(s in t && t[s] !== e[s]) && s in t || (t[s] = e[s], r = !0);
                    r && (_.localStorage.set("sensorsdata_2015_jssdk_profile", JSON.stringify(t)), sd.setProfile(e))
                } else _.localStorage.set("sensorsdata_2015_jssdk_profile", JSON.stringify(e)), sd.setProfile(e)
            }, setInitReferrer: function () {
                var e = _.getReferrer();
                sd.setOnceProfile({_init_referrer: e, _init_referrer_host: _.info.pageProp.referrer_host})
            }, setSessionReferrer: function () {
                var e = _.getReferrer();
                store.setSessionPropsOnce({_session_referrer: e, _session_referrer_host: _.info.pageProp.referrer_host})
            }, setDefaultAttr: function () {
                _.info.register({
                    _current_url: location.href,
                    _referrer: _.getReferrer(),
                    _referring_host: _.info.pageProp.referrer_host
                })
            }, trackHeatMap: function (e, t, r) {
                if ("object" == typeof e && e.tagName) {
                    var s = e.tagName.toLowerCase(), a = e.parentNode.tagName.toLowerCase();
                    "button" === s || "a" === s || "a" === a || "button" === a || "input" === s || "textarea" === s || _.hasAttribute(e, "data-sensors-click") || heatmap.start(null, e, s, t, r)
                }
            }, trackAllHeatMap: function (e, t, r) {
                if ("object" == typeof e && e.tagName) {
                    var s = e.tagName.toLowerCase();
                    heatmap.start(null, e, s, t, r)
                }
            }, autoTrackSinglePage: function (e, t) {
                function r() {
                    var e = _.info.campaignParams(), t = {};
                    for (var r in e) -1 !== (" " + sd.source_channel_standard + " ").indexOf(" " + r + " ") ? t["$" + r] = e[r] : t[r] = e[r];
                    return t
                }

                function s(e, t) {
                    sd.track("$pageview", _.extend({
                        $referrer: a,
                        $url: location.href,
                        $url_path: location.pathname,
                        $title: document.title
                    }, e, r()), t), a = location.href
                }

                if (this.autoTrackIsUsed) var a = _.info.pageProp.url; else var a = _.info.pageProp.referrer;
                e = _.isObject(e) ? e : {}, e = _.isObject(e) ? e : {}, sd.is_first_visitor && !e.not_set_profile && (sd.setOnceProfile(_.extend({
                    $first_visit_time: new Date,
                    $first_referrer: _.getReferrer(),
                    $first_browser_language: navigator.language || "取值异常",
                    $first_browser_charset: "string" == typeof document.charset ? document.charset.toUpperCase() : "取值异常",
                    $first_traffic_source_type: _.getSourceFromReferrer(),
                    $first_search_keyword: _.getKeywordFromReferrer()
                }, r())), sd.is_first_visitor = !1), e.not_set_profile && delete e.not_set_profile, s(e, t), this.autoTrackSinglePage = s
            }, autoTrackWithoutProfile: function (e, t) {
                e = _.isObject(e) ? e : {}, this.autoTrack(_.extend(e, {not_set_profile: !0}), t)
            }, autoTrack: function (e, t) {
                e = _.isObject(e) ? e : {};
                var r = _.info.campaignParams(), s = {};
                for (var a in r) -1 !== (" " + sd.source_channel_standard + " ").indexOf(" " + a + " ") ? s["$" + a] = r[a] : s[a] = r[a];
                sd.is_first_visitor && !e.not_set_profile && (sd.setOnceProfile(_.extend({
                    $first_visit_time: new Date,
                    $first_referrer: _.getReferrer(),
                    $first_browser_language: navigator.language || "取值异常",
                    $first_browser_charset: "string" == typeof document.charset ? document.charset.toUpperCase() : "取值异常",
                    $first_traffic_source_type: _.getSourceFromReferrer(),
                    $first_search_keyword: _.getKeywordFromReferrer()
                }, s)), sd.is_first_visitor = !1), e.not_set_profile && delete e.not_set_profile;
                var n = location.href;
                sd.para.is_single_page && _.addHashEvent(function () {
                    var r = _.getReferrer(n);
                    sd.track("$pageview", _.extend({
                        $referrer: r,
                        $url: location.href,
                        $url_path: location.pathname,
                        $title: document.title
                    }, s, e), t), n = location.href
                }), sd.track("$pageview", _.extend({
                    $referrer: _.getReferrer(),
                    $url: location.href,
                    $url_path: location.pathname,
                    $title: document.title
                }, s, e), t), this.autoTrackIsUsed = !0
            }, getAnonymousID: function () {
                return _.isEmptyObject(sd.store._state) ? "请先初始化SDK" : sd.store._state._first_id || sd.store._state.first_id || sd.store._state._distinct_id || sd.store._state.distinct_id
            }, setPlugin: function (e) {
                return !!_.isObject(e) && void _.each(e, function (e, t) {
                    _.isFunction(e) && (_.isObject(window.SensorsDataWebJSSDKPlugin) && window.SensorsDataWebJSSDKPlugin[t] ? e(window.SensorsDataWebJSSDKPlugin[t]) : sd.log(t + "没有获取到,请查阅文档，调整" + t + "的引入顺序！"))
                })
            }, useModulePlugin: function () {
                sd.use.apply(sd, arguments)
            }, useAppPlugin: function () {
                this.setPlugin.apply(this, arguments)
            }
        };
        sd.quick = function () {
            var e = Array.prototype.slice.call(arguments), t = e[0], r = e.slice(1);
            return "string" == typeof t && commonWays[t] ? commonWays[t].apply(commonWays, r) : void ("function" == typeof t ? t.apply(sd, r) : sd.log("quick方法中没有这个功能" + e[0]))
        }, sd.use = function (e, t) {
            _.isObject(sd.modules) && _.isObject(sd.modules[e]) && _.isFunction(sd.modules[e].init) && (t = t || {}, sd.modules[e].init(sd, t))
        }, sd.track = function (e, t, r) {
            saEvent.check({event: e, properties: t}) && saEvent.send({type: "track", event: e, properties: t}, r)
        }, sd.trackLink = function (e, t, r) {
            "object" == typeof e && e.tagName ? _.trackLink({ele: e}, t, r) : "object" == typeof e && e.target && e.event && _.trackLink(e, t, r)
        }, sd.trackLinks = function (e, t, r) {
            return r = r || {}, !(!e || "object" != typeof e) && !(!e.href || /^javascript/.test(e.href) || e.target) && void _.addEvent(e, "click", function (s) {
                function a() {
                    n || (n = !0, location.href = e.href)
                }

                s.preventDefault();
                var n = !1;
                setTimeout(a, 1e3), sd.track(t, r, a)
            })
        }, sd.setProfile = function (e, t) {
            saEvent.check({propertiesMust: e}) && saEvent.send({type: "profile_set", properties: e}, t)
        }, sd.setOnceProfile = function (e, t) {
            saEvent.check({propertiesMust: e}) && saEvent.send({type: "profile_set_once", properties: e}, t)
        }, sd.appendProfile = function (e, t) {
            saEvent.check({propertiesMust: e}) && (_.each(e, function (t, r) {
                _.isString(t) ? e[r] = [t] : _.isArray(t) ? e[r] = t : (delete e[r], sd.log("appendProfile属性的值必须是字符串或者数组"))
            }), _.isEmptyObject(e) || saEvent.send({type: "profile_append", properties: e}, t))
        }, sd.incrementProfile = function (e, t) {
            var r = e;
            _.isString(e) && (e = {}, e[r] = 1), saEvent.check({propertiesMust: e}) && (function (e) {
                for (var t in e) if (!/-*\d+/.test(String(e[t]))) return !1;
                return !0
            }(e) ? saEvent.send({type: "profile_increment", properties: e}, t) : sd.log("profile_increment的值只能是数字"))
        }, sd.deleteProfile = function (e) {
            saEvent.send({type: "profile_delete"}, e), store.set("distinct_id", _.UUID()), store.set("first_id", "")
        }, sd.unsetProfile = function (e, t) {
            var r = e, s = {};
            _.isString(e) && (e = [], e.push(r)), _.isArray(e) ? (_.each(e, function (e) {
                _.isString(e) ? s[e] = !0 : sd.log("profile_unset给的数组里面的值必须时string,已经过滤掉", e)
            }), saEvent.send({type: "profile_unset", properties: s}, t)) : sd.log("profile_unset的参数是数组")
        }, sd.identify = function (e, t) {
            "number" == typeof e && (e = String(e));
            var r = store.getFirstId();
            if (void 0 === e) {
                var s = _.UUID();
                r ? store.set("first_id", s) : store.set("distinct_id", s)
            } else saEvent.check({distinct_id: e}) ? !0 === t ? r ? store.set("first_id", e) : store.set("distinct_id", e) : r ? store.change("first_id", e) : store.change("distinct_id", e) : sd.log("identify的参数必须是字符串")
        }, sd.trackSignup = function (e, t, r, s) {
            if (saEvent.check({distinct_id: e, event: t, properties: r})) {
                var a = store.getFirstId() || store.getDistinctId();
                store.set("distinct_id", e), saEvent.send({
                    original_id: a,
                    distinct_id: e,
                    type: "track_signup",
                    event: t,
                    properties: r
                }, s)
            }
        }, sd.trackAbtest = function (e, t) {
        }, sd.registerPage = function (e) {
            saEvent.check({properties: e}) ? _.extend(_.info.currentProps, e) : sd.log("register输入的参数有误")
        }, sd.clearAllRegister = function (e) {
            store.clearAllProps(e)
        }, sd.register = function (e) {
            saEvent.check({properties: e}) ? store.setProps(e) : sd.log("register输入的参数有误")
        }, sd.registerOnce = function (e) {
            saEvent.check({properties: e}) ? store.setPropsOnce(e) : sd.log("registerOnce输入的参数有误")
        }, sd.registerSession = function (e) {
            saEvent.check({properties: e}) ? store.setSessionProps(e) : sd.log("registerSession输入的参数有误")
        }, sd.registerSessionOnce = function (e) {
            saEvent.check({properties: e}) ? store.setSessionPropsOnce(e) : sd.log("registerSessionOnce输入的参数有误")
        }, sd.login = function (e, t) {
            if ("number" == typeof e && (e = String(e)), saEvent.check({distinct_id: e})) {
                var r = store.getFirstId(), s = store.getDistinctId();
                e !== s ? (r || store.set("first_id", s), sd.trackSignup(e, "$SignUp", {}, t)) : t && t()
            } else sd.log("login的参数必须是字符串"), t && t()
        }, sd.logout = function (e) {
            var t = store.getFirstId();
            if (t) if (store.set("first_id", ""), !0 === e) {
                var r = _.UUID();
                store.set("distinct_id", r)
            } else store.set("distinct_id", t); else sd.log("没有first_id，logout失败")
        }, sd.getPresetProperties = function () {
            var e = {
                $referrer: _.info.pageProp.referrer || "",
                $referrer_host: _.info.pageProp.referrer ? _.getHostname(_.info.pageProp.referrer) : "",
                $url: location.href,
                $url_path: location.pathname,
                $title: document.title || "",
                _distinct_id: store.getDistinctId()
            }, t = _.extend({}, _.info.properties(), sd.store.getProps(), function () {
                var e = _.info.campaignParams(), t = {};
                for (var r in e) -1 !== (" " + sd.source_channel_standard + " ").indexOf(" " + r + " ") ? t["$" + r] = e[r] : t[r] = e[r];
                return t
            }(), e);
            return sd.para.preset_properties.latest_referrer && sd.para.preset_properties.latest_referrer_host && (t.$latest_referrer_host = "" === t.$latest_referrer ? "" : _.getHostname(t.$latest_referrer)), t
        }, sd.detectMode = function () {
            function e() {
                window.sensorsdata_app_call_js = function (e) {
                    e && "visualized" == e && s("undefined" != typeof sa_jssdk_app_define_mode)
                }, s(!1), sd.bridge.app_js_bridge_v1(), _.info.initPage(), sd.para.is_track_single_page && _.addSinglePageEvent(function (e) {
                    var t = function (t) {
                        t = t || {}, e !== location.href && (_.info.pageProp.referrer = e, sd.quick("autoTrack", _.extend({
                            $url: location.href,
                            $referrer: e
                        }, t)))
                    };
                    if ("boolean" == typeof sd.para.is_track_single_page) t(); else if ("function" == typeof sd.para.is_track_single_page) {
                        var r = sd.para.is_track_single_page();
                        _.isObject(r) ? t(r) : !0 === r && t()
                    }
                }), sd.para.batch_send && sd.batchSend.batchInterval(), sd.store.init(), sd.readyState.setState(3), sd._q && _.isArray(sd._q) && sd._q.length > 0 && _.each(sd._q, function (e) {
                    sd[e[0]].apply(sd, Array.prototype.slice.call(e[1]))
                }), _.isObject(sd.para.heatmap) && (heatmap.initHeatmap(), heatmap.initScrollmap())
            }

            var t = {
                searchKeywordMatch: location.search.match(/sa-request-id=([^&#]+)/), isSeachHasKeyword: function () {
                    var e = this.searchKeywordMatch;
                    return e && e[0] && e[1]
                }, hasKeywordHandle: function () {
                    var e = this.searchKeywordMatch, t = location.search.match(/sa-request-type=([^&#]+)/),
                        r = location.search.match(/sa-request-url=([^&#]+)/);
                    heatmap.setNotice(r), _.sessionStorage.isSupport() && (r && r[0] && r[1] && sessionStorage.setItem("sensors_heatmap_url", decodeURIComponent(r[1])), sessionStorage.setItem("sensors_heatmap_id", e[1]), t && t[0] && t[1] ? "1" === t[1] || "2" === t[1] || "3" === t[1] ? (t = t[1], sessionStorage.setItem("sensors_heatmap_type", t)) : t = null : t = null !== sessionStorage.getItem("sensors_heatmap_type") ? sessionStorage.getItem("sensors_heatmap_type") : null), this.isReady(e[1], t)
                }, isReady: function (e, t, r) {
                    sd.para.heatmap_url ? _.loadScript({
                        success: function () {
                            setTimeout(function () {
                                "undefined" != typeof sa_jssdk_heatmap_render && (sa_jssdk_heatmap_render(sd, e, t, r), "object" == typeof console && "function" == typeof console.log && (sd.heatmap_version && sd.heatmap_version === sd.lib_version || console.log("heatmap.js与sensorsdata.js版本号不一致，可能存在风险!")))
                            }, 0)
                        }, error: function () {
                        }, type: "js", url: sd.para.heatmap_url
                    }) : sd.log("没有指定heatmap_url的路径")
                }, isStoregeHasKeyword: function () {
                    return _.sessionStorage.isSupport() && "string" == typeof sessionStorage.getItem("sensors_heatmap_id")
                }, storageHasKeywordHandle: function () {
                    heatmap.setNotice(), t.isReady(sessionStorage.getItem("sensors_heatmap_id"), sessionStorage.getItem("sensors_heatmap_type"), location.href)
                }
            }, r = {
                isVtrackMode: !1, loadVtrack: function () {
                    _.loadScript({
                        success: function () {
                        },
                        error: function () {
                        },
                        type: "js",
                        url: location.protocol + "//static.sensorsdata.cn/sdk/" + sd.lib_version + "/vtrack.min.js"
                    })
                }, messageListener: function (e) {
                    return "sa-fe" === e.data.source && void ("v-track-mode" === e.data.type && (e.data.data && e.data.data.isVtrack && (r.isVtrackMode = !0, r.loadVtrack()), window.removeEventListener("message", r.messageListener, !1)))
                }, removeMessageHandle: function () {
                    window.removeEventListener && window.removeEventListener("message", r.messageListener, !1)
                }, verifyVtrackMode: function () {
                    window.addEventListener && window.addEventListener("message", r.messageListener, !1), window.parent && window.parent.postMessage && window.parent.postMessage({
                        source: "sa-web-sdk",
                        type: "v-is-vtrack",
                        data: {}
                    }, "*")
                }
            }, s = function (e) {
                function t() {
                    var e = [];
                    r.touch_app_bridge || e.push(sd.debug.defineMode("1")), _.isObject(sd.para.app_js_bridge) || (e.push(sd.debug.defineMode("2")), r.verify_success = !1), _.isObject(sd.para.heatmap) && "default" == sd.para.heatmap.clickmap || e.push(sd.debug.defineMode("3")), "fail" === r.verify_success && e.push(sd.debug.defineMode("4"));
                    var t = {callType: "app_alert", data: e};
                    SensorsData_App_Visual_Bridge && SensorsData_App_Visual_Bridge.sensorsdata_visualized_alert_info ? SensorsData_App_Visual_Bridge.sensorsdata_visualized_alert_info(JSON.stringify(t)) : window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage(JSON.stringify(t))
                }

                var r = sd.bridge.initDefineBridgeInfo();
                if (_.isObject(window.SensorsData_App_Visual_Bridge) && window.SensorsData_App_Visual_Bridge.sensorsdata_visualized_mode && (!0 === window.SensorsData_App_Visual_Bridge.sensorsdata_visualized_mode || window.SensorsData_App_Visual_Bridge.sensorsdata_visualized_mode())) if (_.isObject(sd.para.heatmap) && "default" == sd.para.heatmap.clickmap) if (_.isObject(sd.para.app_js_bridge) && "success" === r.verify_success) if (e) sa_jssdk_app_define_mode(sd, e); else {
                    var s = location.protocol, a = ["http:", "https:"];
                    s = _.indexOf(a, s) > -1 ? s : "https:", _.loadScript({
                        success: function () {
                            setTimeout(function () {
                                "undefined" != typeof sa_jssdk_app_define_mode && sa_jssdk_app_define_mode(sd, e)
                            }, 0)
                        }, error: function () {
                        }, type: "js", url: s + "//static.sensorsdata.cn/sdk/" + sd.lib_version + "/vapph5define.min.js"
                    })
                } else t(); else t()
            };
            t.isSeachHasKeyword() ? t.hasKeywordHandle() : window.parent !== self ? (r.verifyVtrackMode(), setTimeout(function () {
                return !r.isVtrackMode && (r.removeMessageHandle(), void (t.isStoregeHasKeyword() ? t.storageHasKeywordHandle() : e()))
            }, 1e3)) : e()
        }, BatchSend.prototype = {
            add: function (e) {
                _.isObject(e) && (this.writeStore(e), "track_signup" !== e.type && "$pageview" !== e.event || this.sendStrategy())
            }, remove: function (e) {
                this.sendingData > 0 && --this.sendingData, _.isArray(e) && e.length > 0 && _.each(e, function (e) {
                    _.localStorage.remove(e)
                })
            }, send: function (e) {
                var t = this, r = _.isArray(sd.para.server_url) ? sd.para.server_url[0] : sd.para.server_url;
                _.ajax({
                    url: r,
                    type: "POST",
                    data: "data_list=" + encodeURIComponent(_.base64Encode(JSON.stringify(e.vals))),
                    credentials: !1,
                    timeout: sd.para.batch_send.datasend_timeout,
                    cors: !0,
                    success: function () {
                        t.remove(e.keys)
                    },
                    error: function () {
                        t.sendingData > 0 && --t.sendingData
                    }
                })
            }, sendPrepare: function (e) {
                var t = e.vals, r = sd.para.batch_send.one_send_max_length, s = t.length;
                if (s > 0) if (s <= r) this.send({
                    keys: e.keys,
                    vals: t
                }); else for (var a = 0; a * r < s; a++) this.send({keys: e.keys.splice(0, r), vals: t.splice(0, r)})
            }, sendStrategy: function () {
                var e = this.readStore();
                e.keys.length > 0 && 0 === this.sendingData && (this.sendingData = Math.ceil(e.vals.length / sd.para.batch_send.one_send_max_length), this.sendPrepare(e))
            }, batchInterval: function () {
                var e = this;
                setInterval(function () {
                    e.sendStrategy()
                }, sd.para.batch_send.send_interval)
            }, readStore: function () {
                for (var e = [], t = [], r = null, s = (new Date).getTime(), a = localStorage.length, n = 0; n < a; n++) {
                    var i = localStorage.key(n);
                    0 === i.indexOf("sawebjssdk-") && /^sawebjssdk\-\d+$/.test(i) && (r = localStorage.getItem(i), r ? (r = _.safeJSONParse(r), r && _.isObject(r) ? (r._flush_time = s, e.push(i), t.push(r)) : (localStorage.removeItem(i), sd.log("localStorage-数据parse异常" + r))) : (localStorage.removeItem(i), sd.log("localStorage-数据取值异常" + r)))
                }
                return {keys: e, vals: t}
            }, writeStore: function (e) {
                var t = String(Math.random()).slice(2, 5) + String(Math.random()).slice(2, 5) + String((new Date).getTime()).slice(3);
                localStorage.setItem("sawebjssdk-" + t, JSON.stringify(e))
            }
        }, sd.batchSend = new BatchSend;
        var dataSend = {};
        dataSend.getSendUrl = function (e, t) {
            var r = _.base64Encode(t), s = "crc=" + _.hashCode(r);
            return -1 !== e.indexOf("?") ? e + "&data=" + encodeURIComponent(r) + "&ext=" + encodeURIComponent(s) : e + "?data=" + encodeURIComponent(r) + "&ext=" + encodeURIComponent(s)
        }, dataSend.getSendData = function (e) {
            var t = _.base64Encode(e), r = "crc=" + _.hashCode(t);
            return "data=" + encodeURIComponent(t) + "&ext=" + encodeURIComponent(r)
        }, dataSend.getInstance = function (e) {
            var t = this.getSendType(e), r = new this[t](e), s = r.start;
            return r.start = function () {
                _.isObject(sd.para.is_debug) && sd.para.is_debug.storage && sd.store.requests && sd.store.requests.push({
                    name: this.server_url,
                    initiatorType: this.img ? "img" : "xmlhttprequest",
                    entryType: "resource",
                    requestData: this.data
                });
                var e = this;
                s.apply(this, arguments), setTimeout(function () {
                    e.isEnd(!0)
                }, sd.para.callback_timeout)
            }, r.end = function () {
                this.callback && this.callback();
                var e = this;
                setTimeout(function () {
                    e.lastClear && e.lastClear()
                }, sd.para.datasend_timeout - sd.para.callback_timeout)
            }, r.isEnd = function (e) {
                if (!this.received) {
                    this.received = !0, this.end();
                    var t = this;
                    e ? sd.para.queue_timeout - sd.para.callback_timeout <= 0 ? t.close() : setTimeout(function () {
                        t.close()
                    }, sd.para.queue_timeout - sd.para.callback_timeout) : t.close()
                }
            }, r
        }, dataSend.getSendType = function (e) {
            var t = ["image", "ajax", "beacon"], r = t[0];
            return r = e.config && _.indexOf(t, e.config.send_type) > -1 ? e.config.send_type : sd.para.send_type, "beacon" === r && "function" != typeof navigator.sendBeacon && (r = "image"), "ajax" === r && !1 === _.isSupportCors() && (r = "image"), r
        }, dataSend.image = function (e) {
            this.callback = e.callback, this.img = document.createElement("img"), this.img.width = 1, this.img.height = 1, sd.para.img_use_crossorigin && (this.img.crossOrigin = "anonymous"), this.data = e.data, this.server_url = dataSend.getSendUrl(e.server_url, e.data)
        }, dataSend.image.prototype.start = function () {
            var e = this;
            sd.para.ignore_oom && (this.img.onload = function () {
                this.onload = null, this.onerror = null, this.onabort = null, e.isEnd()
            }, this.img.onerror = function () {
                this.onload = null, this.onerror = null, this.onabort = null, e.isEnd()
            }, this.img.onabort = function () {
                this.onload = null, this.onerror = null, this.onabort = null, e.isEnd()
            }), this.img.src = this.server_url
        }, dataSend.image.prototype.lastClear = function () {
            this.img.src = ""
        }, dataSend.ajax = function (e) {
            this.callback = e.callback, this.server_url = e.server_url, this.data = dataSend.getSendData(e.data)
        }, dataSend.ajax.prototype.start = function () {
            var e = this;
            _.ajax({
                url: this.server_url,
                type: "POST",
                data: this.data,
                credentials: !1,
                timeout: sd.para.datasend_timeout,
                cors: !0,
                success: function () {
                    e.isEnd()
                },
                error: function () {
                    e.isEnd()
                }
            })
        }, dataSend.beacon = function (e) {
            this.callback = e.callback, this.server_url = e.server_url, this.data = dataSend.getSendData(e.data)
        }, dataSend.beacon.prototype.start = function () {
            var e = this;
            "object" == typeof navigator && "function" == typeof navigator.sendBeacon && navigator.sendBeacon(this.server_url, this.data), setTimeout(function () {
                e.isEnd()
            }, 40)
        };
        var sendState = {};
        sd.sendState = sendState, sd.events = new _.eventEmitter, sendState.queue = _.autoExeQueue(), sendState.requestData = null, sendState.getSendCall = function (e, t, r) {
            if (sd.is_heatmap_render_mode) return !1;
            if (sd.readyState.state < 3) return sd.log("初始化没有完成"), !1;
            e._track_id = Number(String(Math.random()).slice(2, 5) + String(Math.random()).slice(2, 4) + String((new Date).getTime()).slice(-4)), sd.para.use_client_time && (e._flush_time = (new Date).getTime());
            var s = e;
            return e = JSON.stringify(e), this.requestData = {
                data: s,
                config: t,
                callback: r
            }, sd.events.tempAdd("send", s), !sd.para.app_js_bridge && sd.para.batch_send && localStorage.length < 200 ? (sd.log(s), sd.batchSend.add(this.requestData.data), !1) : (sd.bridge.dataSend(s, this, r), void sd.log(s))
        }, sendState.prepareServerUrl = function () {
            if ("object" == typeof this.requestData.config && this.requestData.config.server_url) this.sendCall(this.requestData.config.server_url, this.requestData.callback); else if (_.isArray(sd.para.server_url)) for (var e = 0; e < sd.para.server_url.length; e++) this.sendCall(sd.para.server_url[e]); else this.sendCall(sd.para.server_url, this.requestData.callback)
        }, sendState.sendCall = function (e, t) {
            var r = {
                server_url: e,
                data: JSON.stringify(this.requestData.data),
                callback: t,
                config: this.requestData.config
            };
            _.isObject(sd.para.jsapp) && !sd.para.jsapp.isOnline && "function" == typeof sd.para.jsapp.setData ? (delete r.callback, r = JSON.stringify(r), sd.para.jsapp.setData(r)) : this.pushSend(r)
        }, sendState.pushSend = function (e) {
            var t = dataSend.getInstance(e), r = this;
            t.close = function () {
                r.queue.close()
            }, this.queue.enqueue(t)
        };
        var saEvent = {};
        sd.saEvent = saEvent, saEvent.checkOption = {
            regChecks: {regName: /^((?!^distinct_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$)[a-zA-Z_$][a-zA-Z\d_$]{0,99})$/i},
            checkPropertiesKey: function (e) {
                var t = this, r = !0;
                return _.each(e, function (e, s) {
                    t.regChecks.regName.test(s) || (r = !1)
                }), r
            },
            check: function (e, t) {
                return "string" == typeof this[e] ? this[this[e]](t) : this[e](t)
            },
            str: function (e) {
                return !!_.isString(e) || (sd.log("请检查参数格式,必须是字符串"), !0)
            },
            properties: function (e) {
                return _.strip_sa_properties(e), !(e && (_.isObject(e) ? !this.checkPropertiesKey(e) && (sd.log("properties 里的自定义属性名需要是合法的变量名，不能以数字开头，且只包含：大小写字母、数字、下划线，自定义属性不能以 $ 开头"), 0) : (sd.log("properties可以没有，但有的话必须是对象"), 0)))
            },
            propertiesMust: function (e) {
                return _.strip_sa_properties(e), void 0 === e || !_.isObject(e) || _.isEmptyObject(e) ? (sd.log("properties必须是对象且有值"), !0) : !!this.checkPropertiesKey(e) || (sd.log("properties 里的自定义属性名需要是合法的变量名，不能以数字开头，且只包含：大小写字母、数字、下划线，自定义属性不能以 $ 开头"), !0)
            },
            event: function (e) {
                return !(!_.isString(e) || !this.regChecks.regName.test(e)) || (sd.log("请检查参数格式，eventName 必须是字符串，且需是合法的变量名，即不能以数字开头，且只包含：大小写字母、数字、下划线和 $,其中以 $ 开头的表明是系统的保留字段，自定义事件名请不要以 $ 开头"), !0)
            },
            test_id: "str",
            group_id: "str",
            distinct_id: function (e) {
                return !(!_.isString(e) || !/^.{1,255}$/.test(e)) || (sd.log("distinct_id必须是不能为空，且小于255位的字符串"), !1)
            }
        }, saEvent.check = function (e) {
            for (var t in e) if (!this.checkOption.check(t, e[t])) return !1;
            return !0
        }, saEvent.send = function (e, t) {
            var r = {
                distinct_id: store.getDistinctId(),
                lib: {$lib: "js", $lib_method: "code", $lib_version: String(sd.lib_version)},
                properties: {}
            };
            _.isObject(e) && _.isObject(e.properties) && !_.isEmptyObject(e.properties) && e.properties.$lib_detail && (r.lib.$lib_detail = e.properties.$lib_detail, delete e.properties.$lib_detail), _.extend(r, sd.store.getUnionId(), e), _.isObject(e.properties) && !_.isEmptyObject(e.properties) && _.extend(r.properties, e.properties), e.type && "profile" === e.type.slice(0, 7) || (r.properties = _.extend({}, _.info.properties(), store.getProps(), store.getSessionProps(), _.info.currentProps, r.properties), sd.para.preset_properties.latest_referrer && !_.isString(r.properties.$latest_referrer) && (r.properties.$latest_referrer = "取值异常"), sd.para.preset_properties.latest_search_keyword && !_.isString(r.properties.$latest_search_keyword) && (r.properties.$latest_search_keyword = "取值异常"), sd.para.preset_properties.latest_traffic_source_type && !_.isString(r.properties.$latest_traffic_source_type) && (r.properties.$latest_traffic_source_type = "取值异常"), sd.para.preset_properties.latest_landing_page && !_.isString(r.properties.$latest_landing_page) && (r.properties.$latest_landing_page = "取值异常")), r.properties.$time && _.isDate(r.properties.$time) ? (r.time = 1 * r.properties.$time, delete r.properties.$time) : sd.para.use_client_time && (r.time = 1 * new Date), _.parseSuperProperties(r.properties), _.filterReservedProperties(r.properties), _.searchObjDate(r), _.searchObjString(r), _.searchZZAppStyle(r);
            var s = _.searchConfigData(r.properties);
            saNewUser.checkIsAddSign(r), saNewUser.checkIsFirstTime(r), sd.addReferrerHost(r), sd.addPropsHook(r), !0 === sd.para.debug_mode ? (sd.log(r), this.debugPath(JSON.stringify(r), t)) : sd.sendState.getSendCall(r, s, t)
        }, saEvent.debugPath = function (e, t) {
            var r = e, s = "";
            s = -1 !== sd.para.debug_mode_url.indexOf("?") ? sd.para.debug_mode_url + "&data=" + encodeURIComponent(_.base64Encode(e)) : sd.para.debug_mode_url + "?data=" + encodeURIComponent(_.base64Encode(e)), _.ajax({
                url: s,
                type: "GET",
                cors: !0,
                header: {"Dry-Run": String(sd.para.debug_mode_upload)},
                success: function (e) {
                    !0 === _.isEmptyObject(e) ? alert("debug数据发送成功" + r) : alert("debug失败 错误原因" + JSON.stringify(e))
                }
            })
        };
        var store = sd.store = {
            requests: [], _sessionState: {}, _state: {distinct_id: "", first_id: "", props: {}}, getProps: function () {
                return this._state.props || {}
            }, getSessionProps: function () {
                return this._sessionState
            }, getDistinctId: function () {
                return this._state._distinct_id || this._state.distinct_id
            }, getUnionId: function () {
                var e = {}, t = this._state._first_id || this._state.first_id,
                    r = this._state._distinct_id || this._state.distinct_id;
                return t && r ? (e.login_id = r, e.anonymous_id = t) : e.anonymous_id = r, e
            }, getFirstId: function () {
                return this._state._first_id || this._state.first_id
            }, toState: function (e) {
                var t = null;
                if (null != e && _.isJSONString(e)) if (t = JSON.parse(e), this._state = _.extend(t), t.distinct_id) {
                    if ("object" == typeof t.props) {
                        for (var r in t.props) "string" == typeof t.props[r] && (t.props[r] = t.props[r].slice(0, sd.para.max_referrer_string_length));
                        this.save()
                    }
                } else this.set("distinct_id", _.UUID()), sd.debug.distinct_id("1", e); else this.set("distinct_id", _.UUID()), sd.debug.distinct_id("2", e)
            }, initSessionState: function () {
                var e = _.cookie.get("sensorsdata2015session"), t = null;
                null !== e && "object" == typeof (t = JSON.parse(e)) && (this._sessionState = t || {})
            }, setOnce: function (e, t) {
                e in this._state || this.set(e, t)
            }, set: function (e, t) {
                this._state = this._state || {}, "distinct_id" === e && this._state.distinct_id && sd.events.tempAdd("changeDistinctId", t), this._state[e] = t, "first_id" === e ? delete this._state._first_id : "distinct_id" === e && delete this._state._distinct_id, this.save()
            }, change: function (e, t) {
                this._state["_" + e] = t
            }, setSessionProps: function (e) {
                var t = this._sessionState;
                _.extend(t, e), this.sessionSave(t)
            }, setSessionPropsOnce: function (e) {
                var t = this._sessionState;
                _.coverExtend(t, e), this.sessionSave(t)
            }, setProps: function (e, t) {
                var r = {};
                r = t ? e : _.extend(this._state.props || {}, e);
                for (var s in r) "string" == typeof r[s] && (r[s] = r[s].slice(0, sd.para.max_referrer_string_length));
                this.set("props", r)
            }, setPropsOnce: function (e) {
                var t = this._state.props || {};
                _.coverExtend(t, e), this.set("props", t)
            }, clearAllProps: function (e) {
                if (this._sessionState = {}, _.isArray(e) && e.length > 0) for (var t = 0; t < e.length; t++) _.isString(e[t]) && -1 === e[t].indexOf("latest_") && e[t] in this._state.props && delete this._state.props[e[t]]; else for (var t in this._state.props) 1 !== t.indexOf("latest_") && delete this._state.props[t];
                this.sessionSave({}), this.save()
            }, sessionSave: function (e) {
                this._sessionState = e, _.cookie.set("sensorsdata2015session", JSON.stringify(this._sessionState), 0)
            }, save: function () {
                var e = JSON.parse(JSON.stringify(this._state));
                delete e._first_id, delete e._distinct_id, _.cookie.set(this.getCookieName(), JSON.stringify(e), 73e3, sd.para.cross_subdomain)
            }, getCookieName: function () {
                var e = "";
                if (!1 === sd.para.cross_subdomain) {
                    try {
                        e = _.URL(location.href).hostname
                    } catch (e) {
                        sd.log(e)
                    }
                    e = "string" == typeof e && "" !== e ? "sa_jssdk_2015_" + e.replace(/\./g, "_") : "sa_jssdk_2015_root"
                } else e = "sensorsdata2015jssdkcross";
                return e
            }, init: function () {
                this.initSessionState();
                var e = _.UUID(), t = _.cookie.get(this.getCookieName());
                null === t ? (sd.is_first_visitor = !0, this.set("distinct_id", e)) : (_.isJSONString(t) && JSON.parse(t).distinct_id || (sd.is_first_visitor = !0), this.toState(t)), saNewUser.setDeviceId(e), saNewUser.storeInitCheck(), saNewUser.checkIsFirstLatest()
            }
        }, saNewUser = {
            checkIsAddSign: function (e) {
                "track" === e.type && (_.cookie.getNewUser() ? e.properties.$is_first_day = !0 : e.properties.$is_first_day = !1)
            }, is_first_visit_time: !1, checkIsFirstTime: function (e) {
                "track" === e.type && "$pageview" === e.event && (this.is_first_visit_time ? (e.properties.$is_first_time = !0, this.is_first_visit_time = !1) : e.properties.$is_first_time = !1)
            }, setDeviceId: function (e) {
                var t = null, r = _.cookie.get("sensorsdata2015jssdkcross"), s = {};
                null != r && _.isJSONString(r) && (s = JSON.parse(r), s.$device_id && (t = s.$device_id)), t = t || e, !0 === sd.para.cross_subdomain ? store.set("$device_id", t) : (s.$device_id = t, _.cookie.set("sensorsdata2015jssdkcross", JSON.stringify(s), null, !0)), sd.para.is_track_device_id && (_.info.currentProps.$device_id = t)
            }, storeInitCheck: function () {
                if (sd.is_first_visitor) {
                    var e = new Date, t = {h: 23 - e.getHours(), m: 59 - e.getMinutes(), s: 59 - e.getSeconds()};
                    _.cookie.set(_.cookie.getCookieName("new_user"), "1", 3600 * t.h + 60 * t.m + t.s + "s"), this.is_first_visit_time = !0
                } else _.cookie.getNewUser() || (this.checkIsAddSign = function (e) {
                    "track" === e.type && (e.properties.$is_first_day = !1)
                }), this.checkIsFirstTime = function (e) {
                    "track" === e.type && "$pageview" === e.event && (e.properties.$is_first_time = !1)
                }
            }, checkIsFirstLatest: function () {
                for (var e = _.info.pageProp.url_domain, t = ["$utm_source", "$utm_medium", "$utm_campaign", "$utm_content", "$utm_term"], r = store.getProps(), s = 0; s < t.length; s++) t[s] in r && delete r[t[s]];
                store.setProps(r, !0);
                var a = {};
                if ("" === e && (e = "url解析失败"), _.each(sd.para.preset_properties, function (t, r) {
                    if (-1 === r.indexOf("latest_")) return !1;
                    if (r = r.slice(7), t) {
                        if ("utm" !== r && "url解析失败" === e) a["$latest_" + r] = "url的domain解析失败"; else if (_.isReferralTraffic(document.referrer)) switch (r) {
                            case"traffic_source_type":
                                a.$latest_traffic_source_type = _.getSourceFromReferrer();
                                break;
                            case"referrer":
                                a.$latest_referrer = _.info.pageProp.referrer;
                                break;
                            case"search_keyword":
                                a.$latest_search_keyword = _.getKeywordFromReferrer();
                                break;
                            case"landing_page":
                                a.$latest_landing_page = location.href
                        }
                    } else if ("utm" === r && sd.store._state.props) for (var s in sd.store._state.props) 0 !== s.indexOf("$latest_utm") && 0 !== s.indexOf("_latest_") || delete sd.store._state.props[s]; else sd.store._state.props && "$latest_" + r in sd.store._state.props && delete sd.store._state.props["$latest_" + r]
                }), sd.register(a), sd.para.preset_properties.latest_utm) {
                    var n = _.info.campaignParamsStandard("$latest_", "_latest_"), i = n.$utms, o = n.otherUtms;
                    _.isEmptyObject(i) || sd.register(i), _.isEmptyObject(o) || sd.register(o)
                }
            }
        };
        sd.bridge = {
            is_verify_success: !1, initPara: function () {
                var e = {is_send: !0, white_list: [], is_mui: !1};
                "object" == typeof sd.para.app_js_bridge ? sd.para.app_js_bridge = _.extend({}, e, sd.para.app_js_bridge) : !0 === sd.para.use_app_track || !0 === sd.para.app_js_bridge || "only" === sd.para.use_app_track ? (!1 !== sd.para.use_app_track_is_send && "only" !== sd.para.use_app_track || (e.is_send = !1), sd.para.app_js_bridge = _.extend({}, e)) : "mui" === sd.para.use_app_track && (e.is_mui = !0, sd.para.app_js_bridge = _.extend({}, e)), !1 === sd.para.app_js_bridge.is_send && sd.log("设置了 is_send:false,如果打通失败，数据将被丢弃！")
            }, initState: function () {
                function e(e) {
                    function t(e) {
                        var t = {hostname: "", project: ""};
                        try {
                            t.hostname = _.URL(e).hostname, t.project = _.URL(e).searchParams.get("project") || "default"
                        } catch (e) {
                            sd.log(e)
                        }
                        return t
                    }

                    var r = t(e), s = t(sd.para.server_url);
                    if (r.hostname === s.hostname && r.project === s.project) return !0;
                    if (sd.para.app_js_bridge.white_list.length > 0) for (var a = 0; a < sd.para.app_js_bridge.white_list.length; a++) {
                        var n = t(sd.para.app_js_bridge.white_list[a]);
                        if (n.hostname === r.hostname && n.project === r.project) return !0
                    }
                    return !1
                }

                if (_.isObject(sd.para.app_js_bridge) && !sd.para.app_js_bridge.is_mui) if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && _.isObject(window.SensorsData_iOS_JS_Bridge) && window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url) e(window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url) && (sd.bridge.is_verify_success = !0); else if (_.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url && window.SensorsData_APP_New_H5_Bridge.sensorsdata_track) {
                    var t = window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url();
                    t && e(t) && (sd.bridge.is_verify_success = !0)
                }
            }, initDefineBridgeInfo: function () {
                var e = {touch_app_bridge: !0, verify_success: !1};
                return window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage && _.isObject(window.SensorsData_iOS_JS_Bridge) && window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url ? sd.bridge.is_verify_success ? e.verify_success = "success" : e.verify_success = "fail" : _.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url && window.SensorsData_APP_New_H5_Bridge.sensorsdata_track ? sd.bridge.is_verify_success ? e.verify_success = "success" : e.verify_success = "fail" : "object" == typeof SensorsData_APP_JS_Bridge && (SensorsData_APP_JS_Bridge.sensorsdata_verify && SensorsData_APP_JS_Bridge.sensorsdata_visual_verify || SensorsData_APP_JS_Bridge.sensorsdata_track) ? SensorsData_APP_JS_Bridge.sensorsdata_verify && SensorsData_APP_JS_Bridge.sensorsdata_visual_verify ? SensorsData_APP_JS_Bridge.sensorsdata_visual_verify(JSON.stringify({server_url: sd.para.server_url})) ? e.verify_success = "success" : e.verify_success = "fail" : e.verify_success = "success" : !/sensors-verify/.test(navigator.userAgent) && !/sa-sdk-ios/.test(navigator.userAgent) || window.MSStream ? e.touch_app_bridge = !1 : sd.bridge.iOS_UA_bridge() ? e.verify_success = "success" : e.verify_success = "fail", e
            }, iOS_UA_bridge: function () {
                if (/sensors-verify/.test(navigator.userAgent)) {
                    var e = navigator.userAgent.match(/sensors-verify\/([^\s]+)/);
                    if (e && e[0] && "string" == typeof e[1] && 2 === e[1].split("?").length) {
                        e = e[1].split("?");
                        var t = null, r = null;
                        try {
                            t = _.URL(sd.para.server_url).hostname, r = _.URL(sd.para.server_url).searchParams.get("project") || "default"
                        } catch (e) {
                            sd.log(e)
                        }
                        return !(!t || t !== e[0] || !r || r !== e[1])
                    }
                    return !1
                }
                return !!/sa-sdk-ios/.test(navigator.userAgent)
            }, dataSend: function (e, t, r) {
                if (_.isObject(sd.para.app_js_bridge) && !sd.para.app_js_bridge.is_mui) if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage && _.isObject(window.SensorsData_iOS_JS_Bridge) && window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url) sd.bridge.is_verify_success ? (window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage(JSON.stringify({
                    callType: "app_h5_track",
                    data: _.extend({server_url: sd.para.server_url}, e)
                })), "function" == typeof r && r()) : sd.para.app_js_bridge.is_send ? (sd.debug.apph5({
                    data: e,
                    step: "4.1",
                    output: "all"
                }), t.prepareServerUrl()) : "function" == typeof r && r(); else if (_.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url && window.SensorsData_APP_New_H5_Bridge.sensorsdata_track) sd.bridge.is_verify_success ? (SensorsData_APP_New_H5_Bridge.sensorsdata_track(JSON.stringify(_.extend({server_url: sd.para.server_url}, e))), "function" == typeof r && r()) : sd.para.app_js_bridge.is_send ? (sd.debug.apph5({
                    data: e,
                    step: "4.2",
                    output: "all"
                }), t.prepareServerUrl()) : "function" == typeof r && r(); else if ("object" == typeof SensorsData_APP_JS_Bridge && (SensorsData_APP_JS_Bridge.sensorsdata_verify || SensorsData_APP_JS_Bridge.sensorsdata_track)) SensorsData_APP_JS_Bridge.sensorsdata_verify ? SensorsData_APP_JS_Bridge.sensorsdata_verify(JSON.stringify(_.extend({server_url: sd.para.server_url}, e))) ? "function" == typeof r && r() : sd.para.app_js_bridge.is_send ? (sd.debug.apph5({
                    data: e,
                    step: "3.1",
                    output: "all"
                }), t.prepareServerUrl()) : "function" == typeof r && r() : (SensorsData_APP_JS_Bridge.sensorsdata_track(JSON.stringify(_.extend({server_url: sd.para.server_url}, e))), "function" == typeof r && r()); else if (!/sensors-verify/.test(navigator.userAgent) && !/sa-sdk-ios/.test(navigator.userAgent) || window.MSStream) _.isObject(sd.para.app_js_bridge) && !0 === sd.para.app_js_bridge.is_send ? (sd.debug.apph5({
                    data: e,
                    step: "2",
                    output: "all"
                }), t.prepareServerUrl()) : "function" == typeof r && r(); else {
                    var s = null;
                    sd.bridge.iOS_UA_bridge() ? (s = document.createElement("iframe"), s.setAttribute("src", "sensorsanalytics://trackEvent?event=" + encodeURIComponent(JSON.stringify(_.extend({server_url: sd.para.server_url}, e)))), document.documentElement.appendChild(s), s.parentNode.removeChild(s), s = null, "function" == typeof r && r()) : sd.para.app_js_bridge.is_send ? (sd.debug.apph5({
                        data: e,
                        step: "3.2",
                        output: "all"
                    }), t.prepareServerUrl()) : "function" == typeof r && r()
                } else _.isObject(sd.para.app_js_bridge) && sd.para.app_js_bridge.is_mui ? _.isObject(window.plus) && window.plus.SDAnalytics && window.plus.SDAnalytics.trackH5Event ? (window.plus.SDAnalytics.trackH5Event(data), "function" == typeof r && r()) : _.isObject(sd.para.app_js_bridge) && !0 === sd.para.app_js_bridge.is_send ? t.prepareServerUrl() : "function" == typeof r && r() : (sd.debug.apph5({
                    data: e,
                    step: "1",
                    output: "code"
                }), t.prepareServerUrl())
            }, app_js_bridge_v1: function () {
                function e(e) {
                    s = e, _.isJSONString(s) && (s = JSON.parse(s)), a && (a(s), a = null, s = null)
                }

                function t() {
                    "object" == typeof window.SensorsData_APP_JS_Bridge && window.SensorsData_APP_JS_Bridge.sensorsdata_call_app && (s = SensorsData_APP_JS_Bridge.sensorsdata_call_app(), _.isJSONString(s) && (s = JSON.parse(s)))
                }

                function r() {
                    if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
                        var e = document.createElement("iframe");
                        e.setAttribute("src", "sensorsanalytics://getAppInfo"), document.documentElement.appendChild(e), e.parentNode.removeChild(e), e = null
                    }
                }

                var s = null, a = null;
                window.sensorsdata_app_js_bridge_call_js = function (t) {
                    e(t)
                }, sd.getAppStatus = function (e) {
                    return r(), t(), e ? void (null === s ? a = e : (e(s), s = null)) : s
                }
            }
        };
        var heatmap = sd.heatmap = {
            setNotice: function (e) {
                sd.is_heatmap_render_mode = !0, sd.para.heatmap || (sd.errorMsg = "您SDK没有配置开启点击图，可能没有数据！"), e && e[0] && e[1] && "http:" === e[1].slice(0, 5) && "https:" === location.protocol && (sd.errorMsg = "您的当前页面是https的地址，神策分析环境也必须是https！"), sd.para.heatmap_url || (sd.para.heatmap_url = location.protocol + "//static.sensorsdata.cn/sdk/" + sd.lib_version + "/heatmap.min.js")
            }, getDomIndex: function (e) {
                if (!e.parentNode) return -1;
                for (var t = 0, r = e.tagName, s = e.parentNode.children, a = 0; a < s.length; a++) if (s[a].tagName === r) {
                    if (e === s[a]) return t;
                    t++
                }
                return -1
            }, selector: function (e) {
                var t = e.parentNode && 9 == e.parentNode.nodeType ? -1 : this.getDomIndex(e);
                return e.getAttribute && e.getAttribute("id") && (!sd.para.heatmap || sd.para.heatmap && "not_use_id" !== sd.para.heatmap.element_selector) ? "#" + e.getAttribute("id") : e.tagName.toLowerCase() + (~t ? ":nth-of-type(" + (t + 1) + ")" : "")
            }, getDomSelector: function (e, t) {
                if (!e || !e.parentNode || !e.parentNode.children) return !1;
                t = t && t.join ? t : [];
                var r = e.nodeName.toLowerCase();
                return e && "body" !== r && 1 == e.nodeType ? (t.unshift(this.selector(e)), e.getAttribute && e.getAttribute("id") && sd.para.heatmap && "not_use_id" !== sd.para.heatmap.element_selector ? t.join(" > ") : this.getDomSelector(e.parentNode, t)) : (t.unshift("body"), t.join(" > "))
            }, na: function () {
                var e = document.documentElement.scrollLeft || window.pageXOffset;
                return parseInt(isNaN(e) ? 0 : e, 10)
            }, i: function () {
                var e = 0;
                try {
                    e = o.documentElement && o.documentElement.scrollTop || m.pageYOffset, e = isNaN(e) ? 0 : e
                } catch (t) {
                    e = 0
                }
                return parseInt(e, 10)
            }, getBrowserWidth: function () {
                var e = window.innerWidth || document.body.clientWidth;
                return isNaN(e) ? 0 : parseInt(e, 10)
            }, getBrowserHeight: function () {
                var e = window.innerHeight || document.body.clientHeight;
                return isNaN(e) ? 0 : parseInt(e, 10)
            }, getScrollWidth: function () {
                var e = parseInt(document.body.scrollWidth, 10);
                return isNaN(e) ? 0 : e
            }, W: function (e) {
                var t = parseInt(+e.clientX + +this.na(), 10), e = parseInt(+e.clientY + +this.i(), 10);
                return {x: isNaN(t) ? 0 : t, y: isNaN(e) ? 0 : e}
            }, start: function (e, t, r, s, a) {
                var n = _.isObject(s) ? s : {}, i = _.isFunction(a) ? a : _.isFunction(s) ? s : void 0;
                if (sd.para.heatmap && sd.para.heatmap.collect_element && !sd.para.heatmap.collect_element(t)) return !1;
                var o = this.getDomSelector(t), d = _.getEleInfo({target: t});
                if (d.$element_selector = o || "", sd.para.heatmap && sd.para.heatmap.custom_property) {
                    var c = sd.para.heatmap.custom_property(t);
                    _.isObject(c) && (d = _.extend(d, c))
                }
                d = _.extend(d, n), "a" === r && sd.para.heatmap && !0 === sd.para.heatmap.isTrackLink ? _.trackLink({
                    event: e,
                    target: t
                }, "$WebClick", d) : sd.track("$WebClick", d, i)
            }, hasElement: function (e) {
                var t = e._getPath();
                if (_.isArray(t) && t.length > 0) for (var r = 0; r < t.length; r++) if (t[r] && t[r].tagName && "a" === t[r].tagName.toLowerCase()) return t[r];
                return !1
            }, initScrollmap: function () {
                if (!_.isObject(sd.para.heatmap) || "default" !== sd.para.heatmap.scroll_notice_map) return !1;
                var e = function () {
                    return !(sd.para.scrollmap && _.isFunction(sd.para.scrollmap.collect_url) && !sd.para.scrollmap.collect_url())
                }, t = function (e) {
                    var t = {};
                    return t.timeout = e.timeout || 1e3, t.func = e.func, t.hasInit = !1, t.inter = null, t.main = function (e, t) {
                        this.func(e, t), this.inter = null
                    }, t.go = function (e) {
                        var r = {};
                        this.inter || (r.$viewport_position = document.documentElement && document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0, r.$viewport_position = Math.round(r.$viewport_position) || 0, r.$viewport_height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0, r.$viewport_width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0, e ? t.main(r, !0) : this.inter = setTimeout(function () {
                            t.main(r)
                        }, this.timeout))
                    }, t
                }({
                    timeout: 1e3, func: function (e, t) {
                        var r = document.documentElement && document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0,
                            s = new Date, a = s - this.current_time;
                        (a > sd.para.heatmap.scroll_delay_time && r - e.$viewport_position != 0 || t) && (e.$url = location.href, e.$title = document.title, e.$url_path = location.pathname, e.event_duration = Math.min(sd.para.heatmap.scroll_event_duration, parseInt(a) / 1e3), sd.track("$WebStay", e)), this.current_time = s
                    }
                });
                t.current_time = new Date, _.addEvent(window, "scroll", function () {
                    return !!e() && void t.go()
                }), _.addEvent(window, "unload", function () {
                    return !!e() && void t.go("notime")
                })
            }, initHeatmap: function () {
                var e = this;
                return !(!_.isObject(sd.para.heatmap) || "default" !== sd.para.heatmap.clickmap) && !(_.isFunction(sd.para.heatmap.collect_url) && !sd.para.heatmap.collect_url()) && ("all" === sd.para.heatmap.collect_elements ? sd.para.heatmap.collect_elements = "all" : sd.para.heatmap.collect_elements = "interact", void ("all" === sd.para.heatmap.collect_elements ? _.addEvent(document, "click", function (t) {
                    var r = t || window.event;
                    if (!r) return !1;
                    var s = r.target || r.srcElement;
                    if ("object" != typeof s) return !1;
                    if ("string" != typeof s.tagName) return !1;
                    var a = s.tagName.toLowerCase();
                    if ("body" === a || "html" === a) return !1;
                    if (!s || !s.parentNode || !s.parentNode.children) return !1;
                    var n = s.parentNode.tagName.toLowerCase();
                    "a" === n || "button" === n ? e.start(r, s.parentNode, n) : e.start(r, s, a)
                }) : _.addEvent(document, "click", function (t) {
                    var r = t || window.event;
                    if (!r) return !1;
                    var s = r.target || r.srcElement;
                    if ("object" != typeof s) return !1;
                    if ("string" != typeof s.tagName) return !1;
                    var a = s.tagName.toLowerCase();
                    if ("body" === a.toLowerCase() || "html" === a.toLowerCase()) return !1;
                    if (!s || !s.parentNode || !s.parentNode.children) return !1;
                    var n = s.parentNode;
                    if ("a" === a || "button" === a || "input" === a || "textarea" === a || _.hasAttribute(s, "data-sensors-click")) e.start(r, s, a); else if ("button" === n.tagName.toLowerCase() || "a" === n.tagName.toLowerCase()) e.start(r, n, s.parentNode.tagName.toLowerCase()); else if ("area" === a && "map" === n.tagName.toLowerCase() && _.ry(n).prev().tagName && "img" === _.ry(n).prev().tagName.toLowerCase()) e.start(r, _.ry(n).prev(), _.ry(n).prev().tagName.toLowerCase()); else {
                        var i = e.hasElement(t);
                        i && e.start(r, i, i.tagName.toLowerCase())
                    }
                })))
            }
        };
        sd.init = function (e) {
            return !(sd.readyState && sd.readyState.state && sd.readyState.state >= 2) && (sd.setInitVar(), sd.readyState.setState(2), sd.initPara(e), void sd.detectMode())
        };
        var methods = ["track", "quick", "register", "registerPage", "registerOnce", "trackSignup", "setProfile", "setOnceProfile", "appendProfile", "incrementProfile", "deleteProfile", "unsetProfile", "identify", "login", "logout", "trackLink", "clearAllRegister"];
        if (_.each(methods, function (e) {
            var t = sd[e];
            sd[e] = function () {
                if (sd.readyState.getState()) return t.apply(sd, arguments);
                try {
                    console.error("请先初始化神策JS SDK")
                } catch (e) {
                    sd.log(e)
                }
            }
        }), "string" != typeof window.sensorsDataAnalytic201505) return void 0 === window.sensorsDataAnalytic201505 ? (window.sensorsDataAnalytic201505 = sd, sd) : window.sensorsDataAnalytic201505;
        sd.setPreConfig(window[sensorsDataAnalytic201505]), window[sensorsDataAnalytic201505] = sd, window.sensorsDataAnalytic201505 = sd, sd.init()
    } catch (e) {
        if ("object" == typeof console && console.log) try {
            console.log(e)
        } catch (e) {
            sd.log(e)
        }
    }
});